This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: TM4C1294NCPDT

Part Number: TM4C1294NCPDT

Hello,

In one of my project I am trying communicate with RS485 device in 9 bit mode using TM4C1294NCPDT.  To test the 9 bit mode.  I configured 2 UARTs - UART2 & UART6.   UART2 is configured as a transmitter  and UART6 as a receiver.  Attaching the code snippet below.  

void ConfigureUARTGal(uint32_t ui32SysClock)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
ROM_GPIOPinConfigure(GPIO_PA6_U2RX );
ROM_GPIOPinConfigure(GPIO_PA7_U2TX );
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);

ROM_UARTConfigSetExpClk(UART2_BASE, ui32SysClock, 19200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE|
UART_CONFIG_PAR_NONE));
UARTFIFOEnable(UART2_BASE);
UART9BitAddrSet(UART2_BASE,0x00,0x00);

UART9BitEnable( UART2_BASE );
}

Sends the data {0xFF, 0x06, 0x43, 0x04, 0x00, 0x00}; 

void
ConfigureUARTLoopback(uint32_t ui32SysClock)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
ROM_GPIOPinConfigure(GPIO_PP0_U6RX );
ROM_GPIOPinConfigure(GPIO_PP1_U6TX );
ROM_GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);

ROM_UARTConfigSetExpClk(UART6_BASE, ui32SysClock, 19200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE|
UART_CONFIG_PAR_NONE));
UARTFIFOEnable(UART6_BASE);
UART9BitAddrSet(UART6_BASE,0xFF,0xFF);

UART9BitEnable( UART6_BASE );
}

following code receives the bytes and send it to UART0 which will be displayed on hyperterminal

if(ROM_UARTCharsAvail(UART6_BASE))
{
recvdata=ROM_UARTCharGetNonBlocking(UART6_BASE);
recvdatat= recvdata;
ROM_UARTCharPutNonBlocking(UART0_BASE, recvdata);
}

I am able receive the data if I receive in 8 bit mode.  In 9 bit mode the data is not received.  

Apprecciate your help.

Regards,

Ramesh

  • Hi

    Sorry,  I'm currently OOO with limited access to Internet until next Tuesday. Please expect delay in my response. In the meantime please search e2e archive for any posts that maybe relevant to your question.

  • Hi,

      I don't see in your code sending out the address byte in 9-bit mode. 

  • Hi Charles,

    I do send 9-bit address in another part of code.

    void TransmitPktrrtaskGal(void)
    {
    uint32_t plength;
    uint8_t xtb;
    if (PktLengthgalxy!=0) //CommStateB
    {
    if(CommStategalxy == Ready2Xmit)
    {
    plength=PktLengthgalxy;
    if(plength!=0)
    {
    UART9BitAddrSend(UART2_BASE, *XmitPktArrayPtrgalxy); //(msgLength+30)
    ROM_UARTCharPutNonBlocking(UART0_BASE,*XmitPktArrayPtrgalxy);
    XmitPktArrayPtrgalxy++;
    plength--;
    Pktcountgalxy++;
    CommStategalxy = XmitInProg;
    // ROM_UARTCharPutNonBlocking(UART0_BASE,0x41);
    }


    }
    else if ((CommStategalxy == XmitInProg))
    {

    //send data bytes here

  • HI,

      I'm not familiar with 9bit mode myself and looking through e2e archive, I don't find relevant posts that are helpful either. Do you see the address byte on the bus?

      

  • Yes we do see the address byte in osciloscope.

  • Hi,

      Do you have a logic analyzer capture that shows the stream of address and data bytes? Can you confirm that in the address byte the 9th bit is equal to 1? The 9th bit indicates whether the preceding 8-bits should be interpreted as 'address' or as 'data'. If the 9th bit is a '1', the preceding 8-bits should be interpreted as an 'address' byte. If the 9th bit is a '0', then the preceding 8-bits should be interpreted as a 'data' byte.