embeded/Cortex-M3 Ti2017.03.24 10:58

얘랑은 좀 다른 이야기인데...

rs232 to rs485로 쓰다 보니

485쪽은 TXEN 하면 RX쪽이 Hi-Z로 설정되면서

아마도 0x00으로 들어 오는 듯?


그리고 driverlib에도 RX만 disable 시키는 건 없으니

함수를 하나 만들어서 RX만 disable enable을 시켜서 일단 우회

void

UARTDisable(uint32_t ui32Base)

{

    //

    // Check the arguments.

    //

    ASSERT(_UARTBaseValid(ui32Base));


    //

    // Wait for end of TX.

    //

    while(HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY)

    {

    }


    //

    // Disable the FIFO.

    //

    HWREG(ui32Base + UART_O_LCRH) &= ~(UART_LCRH_FEN);


    //

    // Disable the UART.

    //

    HWREG(ui32Base + UART_O_CTL) &= ~(UART_CTL_UARTEN | UART_CTL_TXE |

                                      UART_CTL_RXE);


일단 정석(?)적인 해결책은 RX에 pull-up을 달아 주는 것

[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/45318]


OD나 PUD 안먹더라니, 직원이 push-pull로 작동한다고 하면 그런거겠지? ㅠㅠ

[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/88669]



9.2.2.27 GPIOPinTypeUART

Configures pin(s) for use by the UART peripheral.

Prototype:

void

GPIOPinTypeUART(unsigned long ulPort,

unsigned char ucPins)

Parameters:

ulPort is the base address of the GPIO port.

ucPins is the bit-packed representation of the pin(s).

Description:

The UART pins must be properly configured for the UART peripheral to function correctly. This

function provides a typical configuration for those pin(s); other configurations may work as well

depending upon the board setup (for example, using the on-chip pull-ups).

The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to

be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO

port pin 1, and so on.

Note:

This cannot be used to turn any pin into a UART pin; it only configures a UART pin for proper

operation. 


신고
Posted by 구차니

댓글을 달아 주세요