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.

RTOS/EK-TM4C1294XL: UART9BitAddrSend and UART9BitAddrSet API

Part Number: EK-TM4C1294XL

Tool/software: TI-RTOS

I want a response from TI.

Currently, I have two EK-TM4C1294XL that I’m using to try out the uart in 9 bit mode.

EK1 is the master and EK2 is the peripheral.

Can you explain how to setup the UART9BitAddrSend and UART9BitAddrSet in the master and in the peripheral so there can be two way communication in 9 bit mode between EK1 and EK2. I want to see the 9 bit address match interrupt happen in both EK1 and EK2. Please use numeric examples for EK1 and EK2.

 

Thank you,

Priya

  • Showing what you are doing now would help.

    Robert
  • Here are the sections of code:

    EK1 (master)

    int

    main(void)

    {

       ROM_UARTEnable(UART5_BASE);

       ROM_UARTFIFODisable(UART5_BASE);

       ROM_UART9BitEnable(UART5_BASE);

       ROM_UART9BitAddrSet(UART5_BASE, 0x43, 0xFF); //x43 is the dummy peripheral address for EK2.

       ROM_UART9BitAddrSend(UART5_BASE, 0x43);

       //

       // Enable the UART interrupt.

       //

       ROM_IntEnable(INT_UART5);

       ROM_UARTIntEnable(UART5_BASE, UART_INT_9BIT | UART_INT_RX | UART_INT_RT);

    void

    UARTIntHandler(void)

    {

       uint32_t ui32Status;

       //

       // Get the interrrupt status.

       //

       ui32Status = UARTIntStatus(UART5_BASE, true);

       //

       // Clear the asserted interrupts.

       //

       ROM_UARTIntClear(UART5_BASE, ui32Status);

       if ((UART_INT_RT & ui32Status) == UART_INT_RT){

           while(ROM_UARTBusy(UART5_BASE))

                           {

                               // Do nothng

                           }

       }

       if ( ((UART_INT_RX & ui32Status) == UART_INT_RX )){

            if(GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1))

                                 {

                                     GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);

                                 }

                             else

                                 {

                                     GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);

                                 }

        }

       if ( (UART_INT_9BIT & ui32Status) == UART_INT_9BIT ){

           // Receive uart char

                        while(ROM_UARTCharsAvail(UART5_BASE))

                        {

                            //

                            // Read the next character from the UART and write it back to the UART.

                            //

                            ROM_UARTCharGetNonBlocking(UART5_BASE);

                            //uint32_t c = UARTCharGet(UART5_BASE);

                            //

                            // Blink the LED to show a character transfer is occuring.

                            //

                            if(GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1))

                                        {

                                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);

                                        }

                            else

                                        {

                                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);

                                        }

                        }

        }

    }

    EK2 (peripheral)

    int

    main(void)

    {

    ROM_UARTEnable(UART5_BASE);

       ROM_UART9BitEnable(UART5_BASE);

       ROM_UART9BitAddrSet(UART5_BASE, 0x21, 0xFF);    

    //0x21 dummy address for master EK1

    ROM_UART9BitAddrSend(UART5_BASE, 0x21);

       ROM_UARTFIFODisable(UART5_BASE);

       //

       // Enable the UART interrupt.

       //

       ROM_IntEnable(INT_UART5);

       ROM_UARTIntEnable(UART5_BASE, UART_INT_RT | UART_INT_RX | UART_INT_9BIT);

    void

    UARTIntHandler(void)

    {

       uint32_t ui32Status;

       //

       // Get the interrrupt status.

       //

       ui32Status = UARTIntStatus(UART5_BASE, true);

       //

       //

       // Clear the asserted interrupts.

       //

       ROM_UARTIntClear(UART5_BASE, ui32Status);

       if ((UART_INT_RT & ui32Status) == UART_INT_RT){

           while(ROM_UARTBusy(UART5_BASE))

                          {

                              // Do nothng

                          }

       }

       if ( ((UART_INT_RX & ui32Status) == UART_INT_RX )){

           if(GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1))

                                {

                                    GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);

                                }

                            else

                                {

                                    GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);

                                }

       }

       if ( ((UART_INT_9BIT & ui32Status) == UART_INT_9BIT)){

           // Receive uart char

                while(ROM_UARTCharsAvail(UART5_BASE))

                {

                    //

                    // Read the next character from the UART                 //

                    ROM_UARTCharGetNonBlocking(UART5_BASE);

                }

                if(GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1))

                        {

                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);

                        }

                    else

                        {

                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);

                        }

                RxComplete = 1;

       }

    }

    Picture of setup (EK1 and EK2 powered separately).

    Thank you,

    Priya

  • Two immediate problems I see

       if ((UART_INT_RT & ui32Status) == UART_INT_RT){
    
           while(ROM_UARTBusy(UART5_BASE))
    
                           {
    
                               // Do nothng
    
                           }
    
       }
    

    You are not doing anything in response to a receive timeout. So anything received that does not exceed the receive threshold will be lost.

      if ( (UART_INT_9BIT & ui32Status) == UART_INT_9BIT ){
    
           // Receive uart char
    
                        while(ROM_UARTCharsAvail(UART5_BASE))
    
                        {
    
                            //
    
                            // Read the next character from the UART and write it back to the UART.
    
                            //
    
                            ROM_UARTCharGetNonBlocking(UART5_BASE);
    
                            //uint32_t c = UARTCharGet(UART5_BASE);
    
                            //
    
                            // Blink the LED to show a character transfer is occuring.
    
                            //
    
                            if(GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1))
    
                                        {
    
                                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0);
    
                                        }
    
                            else
    
                                        {
    
                                            GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 2);
    
                                        }
    
                        }
    

    You attempt to read a character in the nine-bit interrupt response. First you don't send any characters after the nine bit one. Second, even if you did, there wouldn't be time to have one fully received and in the FIFO to read.

    Robert