You are currently viewing How to Interface UART with TMS320C5505

How to Interface UART with TMS320C5505

Spread the love

The TMS320C5505 DSP Development Board is specially desgined for developers in dsp field as well as beginners. The kit is designed in such way that all the possible features of the DSP will be easily used by the everyone.

The kit supports in Code Composer Studio v4 and later, with XDS100 v1 USB Emulator which is done USB port.

UART

UART (Universal Asynchronous Receiver Transmitter) are one of the basic interfaces which provide a cost effective simple and reliable communication between one controller to another controller or between a controller and PC.

a. RS-232 Level Converter

Usually all the digital ICs work on TTL or CMOS voltage levels which cannot be used to communicate over RS-232 protocol. So a voltage or level converter is needed which can convert TTL to RS232 and RS232 to TTL voltage levels. The most commonly used RS-232 level converter is MAX232.

This IC includes charge pump which can generate RS232 voltage levels (-10V and +10V) from 5V power supply. It also includes two receiver and two transmitters and is capable of full-duplex UART/USART communication.

RS-232 communication enables point-to-point data transfer. It is commonly used in data acquisition applications, for the transfer of data between the microcontroller and a PC.

The voltage levels of a microcontroller and PC are not directly compatible with those of RS-232, a level transition buffer such as MAX232 be used.

Interfacing UART

Fig. 1 shows how to interface the UART to microcontroller. To communicate over SCI, UART or USART, we just need three basic signals which are namely, RXD (receive), TXD (transmit), GND (common ground). So to interface UART with TMS320F2812 we just need the basic signals.

Fig. 1 Interfacing UART to Microcontroller

Interfacing UART with TMS320C5505

We now want to display a text in PC from C5505 Evaluation Board by using SCI module. In C5505 Evaluation Board contains TMS320C5505 Processor, it has two serial interfaces that are SCI A & SCI B. Here we are using SCI A. The Transmitter pins send the data into PC.

Circuit Diagram to Interface UART with TMS320C5505

C Program to Transmit and Receive data using TMS320C5505 KIT

#include "stdio.h"
#include "usbstk5515.h"
void TEST_execute( Int16 ( *funchandle )( ), char *testname, Int16 testid )
{
    Int16 status;

    /* Display test ID */
    printf( "%02d  Testing %s...\n", testid, testname );

    /* Call test function */
    status = funchandle( );

    /* Check for test fail */
    if ( status != 0 )
    {
        /* Print error message */
        printf( "     FAIL... error code %d... quitting\n", status );

        /* Software Breakpoint to Code Composer */
        SW_BREAKPOINT;
    }
    else
    {
        /* Print error message */
        printf( "    PASS\n" );
    }
}



extern Int16 uart_test( );
void main( void )
{
    /* Initialize BSL */
    USBSTK5515_init( );
    printf("EXBUSSEL = %02x\n", SYS_EXBUSSEL);
    
    TEST_execute( uart_test, "UART", 1 );

    printf( "\n***ALL Tests Passed***\n" );
    SW_BREAKPOINT;
}
#include "usbstk5515.h"
#include "usbstk5515_uart.h"
Int16 uart_test()
{
    Int16 i, errors = 0;
   
    Uint8 rx[256];
    Uint8 tx[256];

    Int16 timeout = 0;

    /* Open Uart Handle */
    EVM5515_UART_open( );

    /* Setup buffers */
    for ( i = 0 ; i < 0x100 ; i++ )
    {
        tx[i] = i;
        rx[i] = 0;
    }

    /* UART Test */
    for ( i = 0 ; i < 0x100 ; i++ )
   
 {
        /* TX */
  //      timeout = test_timeout;
        while((UART_LSR & 0x60)==0);  // Wait for TX ready
    /*    {
            if ( timeout-- < 0 )
                return -1;
        }*/

        EVM5515_UART_putChar( tx[i] );    // Write 1 byte

        /* RX */
   //     timeout = test_timeout;
        while((UART_LSR & 0x01)==0);  // Wait for Rx ready
        /*{
            if ( timeout-- < 0 )
                return -1;
       
 }*/

        EVM5515_UART_getChar( &rx[i] );   // Read 1 byte
    }

    /* Compare TX & RX buffers */
    for ( i = 0 ; i < 0x100 ; i++ )
        if ( tx[i] != rx[i] )
            errors++;
    return errors;
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.