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.

TMS320F2812: Serial Communications Interface Requires Bit-Shift and Inversion to Work on eZdsp Eval Board

Part Number: TMS320F2812

I am currently using an eZdsp F2812 evaluation board and trying to get the serial communications interface (SCI) to work. I have configured the SCI for 9600 Baud, 8 data bits, 1 stop bit, and parity none (as shown in the InitSerialPort function below). The Development Environment is Code Composer Suite v7 (7.3.0).

void InitSerialPort(void)
{
    int baudRateRegister = 0;

    /* Channel A Setup */
    SciaRegs.SCICCR.all = 0x0007;    // 8 data bits, 1 stop bit, parity-none
    SciaRegs.SCICTL1.all = 0x0043;   // enable TX, RX, internal SCICLK, Disable RX ERR, SLEEP, TXWAKE

    SciaRegs.SCICTL2.bit.TXINTENA = 0;   // No tx interrupt
    SciaRegs.SCICTL2.bit.RXBKINTENA = 0; // No rx interrupt

    baudRateRegister = 37500000/(8 * 9600) - 1;
    SciaRegs.SCIHBAUD = (baudRateRegister & 0xFF00) >> 8;
    SciaRegs.SCILBAUD = baudRateRegister & 0x00FF;

    SciaRegs.SCIFFTX.all=0xC001;    // Int when  1 byte left (disabled)
    SciaRegs.SCIFFRX.all=0x002F;    // Int when 15 bytes present
    SciaRegs.SCIFFCT.all=0x0000;

    SciaRegs.SCICTL1.all =0x0063;   // Relinquish SCI from Reset
    SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
    SciaRegs.SCIFFRX.bit.RXFIFORESET=1;

} /* InitSerialPort */

Using the eval board, I’ve connected the SCITXDA (P8-3)/SCIRXDA (P8-4) pins to the TxD/RxD pins on my RS232-to-USB adapter. The ground on the adapter is connected to P8-19 (Analog Ground). The RS232-to-USB adapter is connected to my laptop where I’m running a PuTTY client. I’m assuming the communications standard is RS-232.

After calling the InitSerialPort (along with the other DSP Initialization routines), I call the ReportResults function, which is continuously outputting the character ‘A’. 

void ReportResults(void)
{
    char transmitBuffer[TRANSMIT_BUFFER_BYTE_LENGTH] = {0};
    int characterCount = 0;

    sprintf(transmitBuffer, "A");
    characterCount = strlen(transmitBuffer);
    SendBuffer(SERIAL_PORT_A, transmitBuffer, characterCount);

} /* ReportResults */

In order for the ‘A’ character to be displayed in PuTTY, I must modify the character’s ASCII value by left-shifting by one bit and then inverting the shifted value. This is accomplished in the ModCharacter function, which is called by SendBuffer.

int SendBuffer(char portSelection, char *buffer, Uint16 bufferByteCount)
{
    int index;
    int count = 0;

    for (index=0; index < bufferByteCount; index++)
    {
        SciaRegs.SCITXBUF = ModCharacter(buffer[index] & 0x00FF);
        while (SciaRegs.SCICTL2.bit.TXRDY != 1);
        count++;
    }

  // return bytes accepted
  return count;

} /* SendBuffer */


char ModCharacter(char character)
{
    char tempCharacter = character << 1;
    return (~tempCharacter);

} /* ModCharacter */

I’ve attached the screen shot from the scope of the ‘A’ character on the TxD pin. My question is why do I need to bit-shift and invert the data?

When I try to send data to the eZdsp eval card, then the communications is in the correct Start-Data-Stop-Bit order and not understood by the UART. I receive an RxError from the UART as expected. If I could invert the data and then right-shift the it by one bit, then it might work.

  • Larry,

    Please double check the SCICCR register settings (i.e. characters length, number of stop bits, parity, etc.) and compare it to the settings in PuTTY. This needs to match at both ends - PC and target board, and this might be causing the issue that you are seeing with the data frames. Please let me know if this solves your problem. Also, please use the green "Verified Answer" button if your project is now working.

    - Ken
  • The SCICCR register setting is 0x0007, which configures the UART for 8 data bits, one stop bit, and parity none.  The PuTTY client is configured with the same settings.

    I forgot to attach the screen captures from the scope in the initial report.  Instead of the intended scope capture, I’ve attached new captures under two different cases.  In the first case, I’m outputting 0x00 continuously and receiving 0xFF in the log file that is captured using PuTTY.  (I have PuTTY to capture All Session Output.)  The associated screen capture is named, “FFs in PuTTY.png” (top capture).  In the second case, I’m outputting 0xFF continuously and receiving 0x00 in the PuTTY log file.  The associated scope capture is named, “00s in PuTTY.png” (bottom capture).
    FFs in PuTTY.png
    00s in PuTTY.png
    At this moment, I'm still experiencing the same problem.
    The SCICCR register setting is 0x0007, which configures the UART for 8 data bits, one stop bit, and parity none.  The PuTTY client is configured with the same settings.

    I forgot to attach the screen captures from the scope in the initial report.  I’ve attached new captures under two different cases.  In the first case, I’m outputting 0x00 continuously and receiving 0xFF in the log file that is captured using PuTTY.  (I have PuTTY to capture All Session Output.)  The associated screen capture is named, “FFs in PuTTY.png”.  In the second case, I’m outputting 0xFF continuously and receiving 0x00 in the PuTTY log file.  The associated scope capture is named, “00s in PuTTY.png”.

  • Could you please provide the wiring diagram between the eZdsp and the PC? Specifically, is there a RS232 transceiver on the eZdsp side?

  • Here is the schematic for the eZdsp evaluation board: c2000.spectrumdigital.com/.../ezf2812_schem.pdf
    I don’t see an RS232 transceiver.
  • RS232 transceivers typically do an inversion of the signals. Normally , they are on both sides of the communicating devices, so this inversion cancels out. If you indeed managed to interface the SCI signals directly to the converter, there is only one inversion, which does not get cancelled out, which could explain this behavior. Please add a transceiver on the eZdsp side and re-do the experiment.
  • An RS-232 to TTL serial converter was added between the eZdsp eval board and the RS-232 to USB adapter. I was successful in transmitting ASCII data to the PuTTY client. This solved my communications problem.