Other Parts Discussed in Thread: C2000WARE
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