Part Number: TMS320F28055
Other Parts Discussed in Thread: C2000WARE
Hi,
I'm working on setting up a UART interrupt for the F28055 chip, but the interrupt for the RX line is not getting triggered even though I am sending data to it via UART. I have intialized the interrupts for the RX and TX pins and enabled the clock for SCI C. Could you advise me on what I can do to resolve this issue?
These are a few of the functions I have in my code so far:
#
void UART_PIN_init(void)
{
test_code = 2;
// GPIO27 for SCITXDC_Z and GPIO26 for SCIRXDC_Z
EALLOW;
GpioCtrlRegs.GPAMUX2.bit.GPIO27 = 2; // set GPIO27 pin as SCITXDC_Z
GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 2 ; // set GPIO26 pin as SCIRXDC_Z
GpioCtrlRegs.GPADIR.bit.GPIO27 = 1; // set SCITXDC_Z (GPIO27) as output pin
GpioCtrlRegs.GPADIR.bit.GPIO26 = 0; // set SCIRXDC_Z (GPIO26) as input pin
GpioCtrlRegs.GPAPUD.bit.GPIO27 = 1; // disable pull up
GpioCtrlRegs.GPAPUD.bit.GPIO26 = 1; // disable pull up
EDIS;
}
void SCI_C_init(void)
{
test_code = 3;
ScicRegs.SCICTL1.bit.SWRESET = 0;
// set the clock rate supplied to SCI module
EALLOW;
SysCtrlRegs.PCLKCR0.bit.SCICENCLK = 1; // enable the low speed clock
EDIS;
// set desired baud rate - 9600, BRR = 1301
ScicRegs.SCIHBAUD = 5;
ScicRegs.SCILBAUD = 21;
// set data format for port
ScicRegs.SCICCR.bit.SCICHAR = 7; // Data length is 8 bits
ScicRegs.SCICCR.bit.PARITYENA = 0; //disable parity
ScicRegs.SCICCR.bit.PARITY = 0;
ScicRegs.SCICCR.bit.STOPBITS = 0; // 1 stop bit
/* RX and TX Enable Registers */
ScicRegs.SCICTL1.bit.RXENA = 1;
ScicRegs.SCICTL1.bit.TXENA = 1;
/*RX and TX Interrupt Enable */
ScicRegs.SCICTL2.bit.RXBKINTENA = 1; // receiver-buffer/break interrupt enable
ScicRegs.SCICTL2.bit.TXINTENA = 1; // SCITXBUF-register interrupt enable
ScicRegs.SCICTL1.bit.RXERRINTENA = 1; // SCI receive error interrupt enable
ScicRegs.SCICTL1.bit.SWRESET = 1;
test_code = 4;
}
//TODO: Review implementation to make sure it's done correctly
__interrupt void SCI_RX_ISR(void)
{
test_code = 5;
// store the data from the receive character bits in a variable
receivedChar = ScicRegs.SCIRXBUF.bit.RXDT;
if(receivedChar != 0x0A)
{
RecDataC[index] = receivedChar;
ReceiveBuf_CPU[index] = RecDataC[index];
index++;
}
else
{
//initialize the ReceiveBuf_CPU array
memset(ReceiveBuf_CPU, '\0', 256);
memset(ReceiveBuf_CPU + index, '\0', BUFFER_SIZE - index);
RecDataC[index] = receivedChar;
for(loop = 0; loop < index; loop++)
{
// ASCII values for lowercase letters 'a' to 'z'
if(RecDataC[loop] >= 97 && RecDataC[loop] <= 122)
{
// convert the lowercase letters to uppercase letters
ReceiveBuf_CPU[loop] = RecDataC[loop] - 32;
}
else
{
// copy the character as is if it is already uppercase
ReceiveBuf_CPU[loop] = RecDataC[loop];
}
}
// sprintf(Reply_String, "SCI/UART is Okay! \r\n%s\r\n", ReceiveBuf_CPU);
// printMSG(Reply_String);
RecDataC[index] = '\0';
index = 0;
}
PieCtrlRegs.PIEACK.bit.ACK8 = 1;
test_code = 6;
}
__interrupt void SCI_TX_ISR(void)
{
test_code = 7;
PieCtrlRegs.PIEACK.bit.ACK8 = 1;
}