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.

uart communication

Other Parts Discussed in Thread: EK-TM4C123GXL, MSP430G2553

Im using the TM4C123G6HPM  along with the kentec display EB-LM4F120-L35.  below is a section of code im using for push buttons. the idea is when a button is pressed a uart signal is sent through a port pin. how can i get a signal through these port pins.  everything works fine when i use PA0 and PA1 i can get a signal to display using putty, but with this nothng happens

void

OnButtonPress(tWidget *pWidget)

{

       uint32_t ulIdx;

       uint32_t ui32ADC0Value[4];

       volatile uint32_t ui32TempAvg;

       volatile uint32_t ui32TempValueC;

       volatile uint32_t ui32TempValueF;

       //

       SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

 

                         SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);

                         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

 

                         GPIOPinConfigure(GPIO_PD6_U2RX);

                         GPIOPinConfigure(GPIO_PD7_U2TX);

                         GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);

 

 

                         UARTConfigSetExpClk(UART2_BASE, SysCtlClockGet(),115200,

                             (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

 

 

       // Find the index of this push button.

       //

       for(ulIdx = 0; ulIdx < NUM_PUSH_BUTTONS; ulIdx++)

       {

              if(pWidget == (tWidget *)(g_psPushButtons + ulIdx))

              {

                     break;

              }

       }

 

       //

       // Return if the push button could not be found.

       //

       if(ulIdx == NUM_PUSH_BUTTONS)

              {

                     return;

              }

       else if(ulIdx == 0)

              {

                           UARTCharPut(UART2_BASE, 'E');

              }

       else if(ulIdx == 1)

              {

                      UARTCharPut(UART2_BASE, 'N');

 

              }

       else if(ulIdx == 2)

              {

                      UARTCharPut(UART2_BASE, 't');

 

              }

 

       else if(ulIdx == 3)

              {

                      UARTCharPut(UART2_BASE, 'e');

 

              }

 

       else if(ulIdx == 4)

              {

                      UARTCharPut(UART2_BASE, 'g');

 

              }

 

       else if(ulIdx == 5)

              {

                      UARTCharPut(UART2_BASE, 'f');

 

              }

       //

              // Toggle the state of this push button indicator.

              //

              g_ulButtonState ^= 1 << ulIdx;

 

       // Set the matching indicator based on the selected state of the check box.

       //

       CanvasImageSet(g_psPushButtonIndicators + ulIdx,

                     (g_ulButtonState & (1 << ulIdx)) ? g_pucLightOn :

                                  g_pucLightOff);

       WidgetPaint((tWidget *)(g_psPushButtonIndicators + ulIdx));

      

      

}

  • Hello Stephen

    If you are using the EK-TM4C123GXL, the use of UART0 is the only method to connect to the TeraTerm w/o having to make any changes. If you plan to use another UART then there are two options

    1. Use an external USB 2 UART converter
    2. Convert the pins PA0 and PA1 to GPIO Input in the code. Wire the PD6 and PD7 to the PA0 and PA1 to override the UART0 connection to the ICDI for use over the existing board connection.
  • Thanks Amit for your reply’
    This is the first time that I have used the EK-TM4C123GXL. I’m using it for a college project. The reason I need to use PD6 and PD7 is that there will be a transceiver RFD21733 connected to these pins. When a button is pressed on the kentec display it will send a signal to the pins and then wirelessly to another microcontroller an msp430g2553 which I am more familiar with. The msp430 will receive the signal an turn on leds which are supposed to be locked doors.
    Is option 2 the only way to get a signal to PD6 and PD7 or am I missing something in my code to enable uart on these pins.
    Thanks,
    Stephen Boyce
  • Hello Stephen

    PD7 is a locked pin on the TM4C123x devices. Please refer to the following post on how to unlock it. Only after unlocking the pin can you reconfigure it for UART operation and that is why I believe the UART TX is not working.

    e2e.ti.com/.../374640
  • Amit  thanks for your help an sorry for not replying earlier.  Unfortunately the problems i was having were due to human error.  I had the launchpad connected to my pc via a FTDI cable and had RX and TX connected the wrong way RX was connected to RX and TX to TX which explains not seeing a signal.  After switching the connections everything worked fine,

    again thanks for your help ,

    Stephen

  • Hello Stephen

    Thanks for posting the final resolution. Hopefully it may help others.