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.

"Hello World" issue while sending data over UART3 in Tiva-Launchpas



Hi All.


Following is a bare minimum code of interaction with UART3 on the Tiva-Launchpad.

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/rom.h"



int main(int argc, char** argv)
{
    /*
     * Set the clocking to run directly from the crystal.
     */
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);


    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    GPIOPinConfigure(GPIO_PC7_U3TX);
    ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_7);

    ROM_UARTConfigSetExpClk(UART3_BASE, ROM_SysCtlClockGet(), 9600,
                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                             UART_CONFIG_PAR_NONE));

    ROM_UARTCharPut(UART3_BASE, 'a');

    while(1)
    {
    }
    return 0;
}

The pin PC7 is connected to TX-pin of RS232-TTL, and the RS232-TTL further connected to a serial-USB converter.

Finally, the USB is inserted into my laptop running Ubuntu 14.04, and a putty-session opened (using the same BAUD settings as specified in code).

Whenever the program is loaded, a '0' is printed on the putty-session.

Anything wrong in the code? If not, I will proceed to specifying the details of RS232-TTL (don't want to clutter too many things in the question).

A lot of hours have been spent already on this,  any help will be GREATLY appreciated.

Thanks and Regards,

Ajay

  • Hello Ajay

    Do you see that the TX pin of UART is sending the character 'a'

    Also why have you not configured the RX pin?

    Regards
    Amit
  • Hi Amit.

    How can I check that? Using something like oscilloscope?
    (Also, did not configure the RX pin, because I did not want to mix things).
  • Hello Ajay

    On the uC side of the TX, you can use a scope or LA. Better configure the RX (don;t want to run into another problem)

    Regards
    Amit
  • Configured the RX, doesn't make any difference.

    #include <stdint.h>
    #include <stdbool.h>
    #include <string.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "driverlib/rom.h"
    
    
    
    int main(int argc, char** argv)
    {
        /*
         * Set the clocking to run directly from the crystal.
         */
        ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                           SYSCTL_XTAL_16MHZ);
    
    
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    
        GPIOPinConfigure(GPIO_PC6_U3RX);
        GPIOPinConfigure(GPIO_PC7_U3TX);
        ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    
        ROM_UARTConfigSetExpClk(UART3_BASE, ROM_SysCtlClockGet(), 9600,
                                (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                                 UART_CONFIG_PAR_NONE));
    
        ROM_UARTCharPut(UART3_BASE, 'a');
    
        while(1)
        {
        }
        return 0;
    }
    

    Anyways, I expected that this question would be like a walk in the park for TI-experts, turns out it is not :(
    Probably, an example should be put for UARTs other than UART0 (since all other UARTs other than UART0 require a lot more work to get working).

    My 2 cents.

  • Hello Ajay,

    And what about the LA/Scope plot on the UART TX line?

    We will still go systematically about the issue (rather than making it a walk in the park)

    Regards
    Amit
  • Hi Amit.

    It turned out that the Serial-USB converter was faulty.
    We ordered a different brand, and things proceeded fine.

    Sorry for my harsh words in despair.

    Thanks and Regards,
    Ajay
  • Let the record show that "thousands" of posts have proved, "Walk in the park" for the talented & uber dedicated Amit. Yet - he is far too gracious to present that fact.

    On any new system - "everything" is suspect.   You may consider "muting such venom" until you've completed a, "full/proper" analysis. (which is unlikely to rise to, "walk in the park...")

    Your point of, "Added & amplifying UART examples - outside/beyond those of the "privileged" UART0" - proves very valid.