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.
Hello guys,
I am using the TMS320F28055 microcontroller.
I have a problem with the UART communication.
I have everything configured for my UART baudrate is 9600, everything runs great and my RX buffer receives everything, an interrupt is also enabled.
If I send data to the controller via my PC (baud rate 9600), everything runs great.
As soon as I set the baud rate of the PC to 1200, for example, and send a few times, my RX buffer from the controller crashes and there is a 0 in it.
If I then set the baud rate back to 9600, the controller would have to receive everything again. But the buffer is then still only 0 and he no longer receives anything.
Does anyone know how to fix the problem so that the RX buffer does not crash even if data is sent with an incorrect baud rate.
Thank you for your help.
void init_RS232() { SciaRegs.SCICCR.all = 0b00000111; //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 = 0; SciaRegs.SCICTL2.bit.RXBKINTENA = 1; SciaRegs.SCIHBAUD = 0x0000; // 9600 baud @LSPCLK = 15MHz(60 MHz SYSCLK) SciaRegs.SCILBAUD = 0x00C2; SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset EALLOW; PieVectTable.SCIRXINTA = &Interrupt_SCIa_parameterizationPORT_Isr; EDIS; PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block PieCtrlRegs.PIEIER9.bit.INTx1 = 1; // PIE Group 9, INT1 IER = 0x101; EINT; } void InitSciaGpio() { EALLOW; // // Enable internal pull-up for the selected pins // Pull-ups can be enabled or disabled disabled by the user. // This will enable the pullups for the specified pins. // GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up for GPIO28 (SCIRXDA) // GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0; // Enable pull-up for GPIO7 (SCIRXDA) GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up for GPIO29 (SCITXDA) // GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up for GPIO12 (SCITXDA) // // Set qualification for selected pins to asynch only // Inputs are synchronized to SYSCLKOUT by default. // This will select asynch (no qualification) for the selected pins. // GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynch input GPIO28 (SCIRXDA) // GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 3; // Asynch input GPIO7 (SCIRXDA) // // Configure SCI-A pins using GPIO regs // This specifies which of the possible GPIO pins will be SCI functional pins. // GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 for SCIRXDA // GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 2; // Configure GPIO7 for SCIRXDA GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // Configure GPIO29 for SCITXDA // GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 2; // Configure GPIO12 for SCITXDA EDIS; }
Hi Markus,
It's possible you are getting a break detect from the data line being pulled low for too long due to the slower baud rate from the transmitter. When a break detect occurs you must reset the SCI module by clearing the SWRESET bit. This function is described in the SCI Control 1 register. You should be able to check if the break detect bit is set during your RX interrupt and reset the SCI module accordingly. Let me know if you have any questions on how to do this.
Thank you,
Luke
Hi Markus,
Glad to know this resolved your issue, I will close this thread.