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.

TMS320F280025C: SCI-A wrong data on RS485: Only 0x55 is correct on TMS320F280025C

Part Number: TMS320F280025C

I am working on the TMS320F280025C controller. I actually want to transmit data using SCI through an RS485 (SN65HVD485) driver and check the received data on the Docklight software.

In both the controller and Docklight settings, the parameters are: 9600 baud rate, no parity, 1 stop bit.

I am using GPIO2 as TXD and GPIO3 as RXD.
The SYSCLK is 100 MHz.

Now, when I transmit 0x55, Docklight correctly receives 0x55.
But when I transmit 0x44, Docklight shows 0xD7.
If I transmit any other value, the received data is always wrong — only 0x55 is received correctly, everything else is incorrect.

This is my code:

#include "f28x_project.h"

uint16_t loopCounter = 0;

// Function Prototypes
void initSCIAEchoback(void);
void transmitSCIAChar(uint16_t a);
void transmitSCIAMessage(unsigned char * msg);
void initSCIAFIFO(void);

// Main
void main(void)
{
    uint16_t ReceivedChar;
    unsigned char *msg;

    // Initialize device clock and peripherals
    InitSysCtrl();

    // Initialize GPIO
    InitGpio();

    // For this example, only init the pins for the SCI-A port.
    // GPIO_SetupPinMux() - Sets the GPxMUX1/2 and GPyMUX1/2 register bits
    // GPIO_SetupPinOptions() - Sets the direction and configuration of GPIOs
    // These functions are found in the F28X7x_Gpio.c file.
    GPIO_SetupPinMux(3, GPIO_MUX_CPU1, 9);   // see datasheet page no.40... 9 is depend on that chart
    GPIO_SetupPinOptions(3, GPIO_INPUT, GPIO_PULLUP);
    GPIO_SetupPinMux(2, GPIO_MUX_CPU1, 9);
    GPIO_SetupPinOptions(2, GPIO_OUTPUT, GPIO_ASYNC);

    GPIO_SetupPinMux(7, GPIO_MUX_CPU1, 0);
    GPIO_SetupPinOptions(7, GPIO_OUTPUT, GPIO_PUSHPULL);

    // Disable CPU interrupts
    DINT;

    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    InitPieCtrl();

    // Disable CPU interrupts and clear all CPU interrupt flags
    IER = 0x0000;
    IFR = 0x0000;

    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR)
    InitPieVectTable();

    loopCounter = 0;

    initSCIAEchoback();                     // Initialize SCI for echoback

    GPIO_WritePin(7, 1); // to transmit signal
    DELAY_US(10*50);         // 1s

    for(;;)
    {
        while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
        SciaRegs.SCITXBUF.all = 0x55;

        DELAY_US(10*50);         // 1s
        loopCounter++;
    }
}

//  initSCIAEchoback - Initialize SCI-A for echo-back
void initSCIAEchoback(void)
{
    //
    // Note: Clocks were turned on to the SCIA peripheral
    // in the InitSysCtrl() function
    //
    SciaRegs.SCICTL1.bit.SWRESET = 0;
    SciaRegs.SCICTL1.bit.SWRESET = 1;

    SciaRegs.SCICCR.all = 0x0007;           // 1 stop bit,  No loopback
                                            // No parity, 8 char bits,
                                            // async mode, idle-line protocol
    SciaRegs.SCICTL1.all = 0x0003;          // enable TX, RX, internal SCICLK,
                                            // Disable RX ERR, SLEEP, TXWAKE
    SciaRegs.SCICTL2.all = 0x0003;
   // SciaRegs.SCICTL2.bit.TXINTENA = 1;
    SciaRegs.SCICTL2.bit.RXBKINTENA = 1;

    SciaRegs.SCIHBAUD.all = 0x0001;
    SciaRegs.SCILBAUD.all = 0x0045;

    SciaRegs.SCIFFTX.all = 0xE040;        //0xE040
    SciaRegs.SCIFFRX.all = 0x2044;        //0x2044
    SciaRegs.SCIFFCT.all = 0x0;

    SciaRegs.SCICTL1.all = 0x0023;  // Relinquish SCI from Reset
 //   SciaRegs.SCIFFRX.bit.RXFIFORESET = 1;
}