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.

CCS/TMS320F28377S: SCI RS485 problem

Part Number: TMS320F28377S
Other Parts Discussed in Thread: ISO3082

Tool/software: Code Composer Studio

Hi,

I am trying to implement the modbus protocol.

After many attempts and help from the forum, I finally manage to correctly receive the frames but I have another problem.
When I pick up the frame in the interrupt, then I have to switch rs485 to sending mode (I do it using GPIO19 connected to DE RS485).
When I do these operations, I get error flags like FE and PE. Does anyone have an idea what could be wrong?

I put my code

Best regards
Szymon

interrupt void scicRxFifoIsr(void)
{
    Uint16i = 0;
    Uint16 z = 0;
    while(ScicRegs.SCIFFRX.bit.RXFFST != 0){
        RxMODBUS[i]=ScicRegs.SCIRXBUF.all;
        i++;// Read data}
   for(z=0;z<500;z++){
    }
    }

    GpioDataRegs.GPASET.bit.GPIO19 = 1;

    ScicRegs.SCIFFRX.bit.RXFFOVRCLR=1;   // Clear Overflow flag
    ScicRegs.SCIFFRX.bit.RXFFINTCLR=1;   // Clear Interrupt flag

    PieCtrlRegs.PIEACK.all|=0x80;       // Issue PIE ack
}

void scia_fifo_init()
{
   ScicRegs.SCICCR.all = 0x0067;      // 1 stop bit,  No loopback
                                      // No parity,8 char bits,
                                      // async mode, idle-line protocol
   ScicRegs.SCICTL1.all = 0x0003;     // enable TX, RX, internal SCICLK,
                                      // Disable RX ERR, SLEEP, TXWAKE
   ScicRegs.SCICTL2.bit.TXINTENA = 0;
   ScicRegs.SCICTL2.bit.RXBKINTENA = 1;
   ScicRegs.SCIHBAUD.all = 0x0000;
   ScicRegs.SCILBAUD.all = 0x00A2;
   ScicRegs.SCICCR.bit.LOOPBKENA = 0; // Enable loop back
   ScicRegs.SCIFFTX.all = 0xC021;
   ScicRegs.SCIFFRX.all = 0x0028;
   ScicRegs.SCIFFCT.all = 0x00;

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

  • Hi Syzmon,

    If you are getting framing and/or parity errors, you probably want to use a scope to monitor the SCI pins. Presumably there is some non-message glitch or other activity on the data lines that causes the SCI module to get confused about where the frames start or end or what their contents are.

    Which RS-485 transceiver are you using?
  • Hi Devin,

    I used ISO3082.

    What's interesting when I read the fifo, the frame is what I expected but the error flags appear so that I can not handle the interruption once again

    . When I remove the GPIO19 status changing part, everything works fine.

    Best regards
    Szymon

  • Hi Szymon,

    Any luck with this? I don't think there is much to do other than observing the SCI pins with a scope to see how the errors are getting introduced to the message.