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.

usb_dev_serial example, change UART module not work

Other Parts Discussed in Thread: EK-TM4C123GXL
Hi everyone.
i use  usb_dev_serial example (in tiva ware) (tiva C lauchpad). And  i try replaced UART0 by UART3 but it not work. Somebody can point my mistake.
I modify some chunk in code example as follows:
 
//*****************************************************************************
//
// Defines required to redirect UART3 via USB.
//
//*****************************************************************************
#define USB_UART_BASE           UART3_BASE
#define USB_UART_PERIPH         SYSCTL_PERIPH_UART3
#define USB_UART_INT            INT_UART3
 
//*****************************************************************************
//
// Defines required to redirect UART3 via USB.
//
//*****************************************************************************
#define TX_GPIO_BASE            GPIO_PORTC_BASE
#define TX_GPIO_PERIPH          SYSCTL_PERIPH_GPIOC
#define TX_GPIO_PIN             GPIO_PIN_7

#define RX_GPIO_BASE            GPIO_PORTC_BASE
#define RX_GPIO_PERIPH          SYSCTL_PERIPH_GPIOC
#define RX_GPIO_PIN             GPIO_PIN_6
 
and i modify file startup_ewarm.c as follows:
   .......
   ......
 
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                                 // UART0 Rx and Tx
    IntDefaultHandler,                      // UART1 Rx and Tx
  ......
  .......
    IntDefaultHandler,                      // GPIO Port L
    IntDefaultHandler,                      // SSI2 Rx and Tx
    IntDefaultHandler,                      // SSI3 Rx and Tx
    USBUARTIntHandler,                              // UART3 Rx and Tx 
    IntDefaultHandler,                      // UART4 Rx and Tx
    IntDefaultHandler,                      // UART5 Rx and Tx
    IntDefaultHandler,                      // UART6 Rx and Tx
......
.......
   thank for your help !
  • Hello Than,

    The following is missing

        ROM_GPIOPinConfigure(GPIO_PC6_U3RX);
        ROM_GPIOPinConfigure(GPIO_PC7_U3TX);


    Please add it before the call ROM_GPIOPinTypeUART

    Regards

    Amit

  • Oh, It's works !

    thank you very much Amit .

  • Ak, Amit , in example usb_dev_serial use UART0 , why we don't use :

        ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
        ROM_GPIOPinConfigure(GPIO_PA1_U0TX);

  • Hello Than

    UART-0 Port Control, Digital Enable and AFSEL is by default set for UART at reset. However other UART's do not have this feature and user code needs to configure the same

    Regards

    Amit

  • Amit Ashara said:
    UART-0 Port Control, Digital Enable and AFSEL is by default set for UART at reset. However other UART's do not have this feature and user code needs to configure the same

    I know this is an old thread, but I just encountered the same problem with the usb_dev_serial example for the EK-TM4C123GXL in TivaWare_C_Series-2.1.0.12573.

    I suggest the example could be improved to explicitly call GPIOPinConfigure rather then relying upon defaults.

    E.g. after changing the example to use UART1 instead of UART0 I added two new defines TX_GPIO_PIN_CONFIGURE and RX_GPIO_PIN_CONFIGURE:

    //*****************************************************************************
    //
    // GPIO peripherals and pins muxed with the redirected UART.  These will depend
    // upon the IC in use and the UART selected in USB_UART_BASE.  Be careful that
    // these settings all agree with the hardware you are using.
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Defines required to redirect UART1 via USB.
    //
    //*****************************************************************************
    #define TX_GPIO_BASE            GPIO_PORTB_BASE
    #define TX_GPIO_PERIPH          SYSCTL_PERIPH_GPIOB
    #define TX_GPIO_PIN             GPIO_PIN_1
    #define TX_GPIO_PIN_CONFIGURE   GPIO_PB1_U1TX
    
    #define RX_GPIO_BASE            GPIO_PORTB_BASE
    #define RX_GPIO_PERIPH          SYSCTL_PERIPH_GPIOB
    #define RX_GPIO_PIN             GPIO_PIN_0
    #define RX_GPIO_PIN_CONFIGURE   GPIO_PB0_U1RX
    

    Which got used in main:

        //
        // Enable and configure the UART RX and TX pins
        //
        ROM_SysCtlPeripheralEnable(TX_GPIO_PERIPH);
        ROM_SysCtlPeripheralEnable(RX_GPIO_PERIPH);
        ROM_GPIOPinConfigure(TX_GPIO_PIN_CONFIGURE);
        ROM_GPIOPinConfigure(RX_GPIO_PIN_CONFIGURE);
        ROM_GPIOPinTypeUART(TX_GPIO_BASE, TX_GPIO_PIN);
        ROM_GPIOPinTypeUART(RX_GPIO_BASE, RX_GPIO_PIN);
    

  • Hi Amit, this is last one promised, Thank to Chester this one can be in UART relative sub forum ;)
  • Hello Chester,

    I agree. There is a thread on sd-card with SSI-1 which was plagued with the same issue (not mentioning the boot loader updates we have to do for TM4C129). Point taken. Let me see how I can push the same into the next SW release.

    Regards
    Amit