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 TI Community,
I'm new to interrupts and need some guidance. I've configured my system to receive characters via UART interrupt and send them back to the console via UART transmission. However, the system isn't receiving characters as expected. Below is the code for your review. Any help would be greatly appreciated.
#include "F28x_Project.h" #include "inc/hw_types.h" #include "driverlib.h" #include "device.h" #include "IQmathLib.h" #include "math.h" #include "FullBridgeInv.h" #include "dlog_4ch.h" #include "F28004x_Gpio.h" #include "asysctl.h " void interrupt void uartRxISR(); void interrupt void uartTxISR(); void initSCIA(); // UART receive interrupt handler interrupt void uartRxISR(void) { // Read received data char receivedChar = SciaRegs.SCIRXBUF.all; // Echo received character back SciaRegs.SCITXBUF.all = receivedChar; // Clear interrupt flag SciaRegs.SCIFFRX.bit.RXFFINTCLR = 1; PieCtrlRegs.PIEACK.all |= PIEACK_GROUP9; } // UART transmit interrupt handler interrupt void uartTxISR(void) { // Clear interrupt flag SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1; PieCtrlRegs.PIEACK.all |= PIEACK_GROUP9; } int main(void) { // Initialize system InitSysCtrl(); // Initialize GPIO for SCI InitSciaGpio(); // Initialize PIE InitPieCtrl(); IER = 0x0000; IFR = 0x0000; PieVectTable.SCIA_RX_INT = &uartRxISR; PieCtrlRegs.PIEIER9.bit.INTx1 = 1; EnableInterrupts(); initSCIA(); while(1) { // Main application loop } } void initSCIA(void) { SciaRegs.SCIFFTX.all = 0xE040; SciaRegs.SCIFFRX.all = 0x2044; SciaRegs.SCIFFCT.all = 0x0; // Note: Clocks were turned on to the SCIA peripheral // in the InitSysCtrl() function // 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; // // SCIA at 9600 baud // @LSPCLK = 25 MHz (100 MHz SYSCLK) HBAUD = 0x01 and LBAUD = 0x44. // SciaRegs.SCIHBAUD.all = 0x0001; SciaRegs.SCILBAUD.all = 0x0044; SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset }
Thank you!
Vishal Tyagi
Hi Vishal,
We don't typically support code reviews on E2E, but I can make some suggestions to help you understand and be able to debug the issue.
Did you utilize or reference any of our existing C2000Ware SCI examples located at {C2000Ware}\driverlib\f28004x\examples\sci already?
There is also an SCI FAQ you may find very helpful: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1031947/faq-my-c2000-sci-is-not-transmitting-and-or-receiving-data-correctly-how-do-i-fix-this.
Please take a look at these resources first and let me know if they are able to aid in finding the issue or if you need further assistance!
Best Regards,
Allison
Hi Allison
Thank you for providing reference for existing C2000Ware SCI examples directory I have found required examples code there that resolve my question.
Regards,
Vishal Tyagi
Glad to hear it, Vishal! I will close this thread. Feel free to open a new thread should you run into further issues
Best Regards,
Allison