Part Number:TMS320F28377S
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; }