I am working with F 28027F chip on a custom board based on BoostXL 8301 Rev B. I am using lab 20 as my basse and developing that project to enable SCI communication with a PC using RTU MODBUS protocol. I have set up the sci.c and sci.h files and when I call the read and write functions in the main loop it seems to be working properly. However I want the receive function to be interrupt driven and transmit function to remain in the main loop.
I have noticed that whenever a string comes in, the interrup is not generated and the SCI ISR never gets executed so basically all the values get overwritten in the Rx Buffer with only the CRC value still there after (as it is the last byte)
I have set up the SCI ISR as follows;
---------------------------------------------------------------------------------------------------------------------
in main.c
interrupt void sciaISR(void)
{
//Sets the sleep bit to zero so that the SCI receive port wakes up.
HAL_sciaDisableSleep(halHandle);
gChar = HAL_sciaRead(halHandle);
if (gRxCount == 0)
{
// If gRxCount is zero it means more than defined time has passed and the incoming
// string is the address byte.
ReceivedString[0] = HAL_sciaRead(halHandle) & 0x00FF;
HAL_pieAckInt(halHandle,PIE_GroupNumber_9); // Issue PIE ack INT9
gReceivePositoin = 1;
}
else
{
// If gRxCount is not zero it means that less than defined time has passed and the incoming
// byte is still a part of the current string.
// check here for while loop attached to the receive flag.
for ( gReceivePositoin=1; gReceivePositoin<239; gReceivePositoin++)
{
ReceivedString[gReceivePositoin] = HAL_sciaRead(halHandle) & 0x0FF;
HAL_pieAckInt(halHandle, PIE_GroupNumber_9);
}
}
gRxCount = 10;
HAL_sciaEnableSleep(halHandle);
return;
}// end of sciaISR(void) function.
----------------------------------------------------------------------------------------------------------------------------------
In hal.c
void HAL_setupSCI(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *) handle;
// SCIFFTX = 0xE040
SCI_enableChannels(obj->sciaHandle); // SCI reset
SCI_enableTxFifoEnh(obj->sciaHandle); // SCI FIFO transmit enable
SCI_enableTxFifo(obj->sciaHandle); // SCI FIFO transmit reset/reenable
SCI_clearTxFifoInt(obj->sciaHandle); // SCI clear FIFO transmit interrupt flag
SCI_disableTxFifoInt(obj->sciaHandle); // disable FIFO transmit interrupt
SCI_setTxFifoIntLevel(obj->sciaHandle, SCI_FifoLevel_Empty); // FIFO interrupt level
SCI_enableRxFifo(obj->sciaHandle); // SCI FIFO receive reset/reenable
SCI_clearRxFifoInt(obj->sciaHandle); // SCI clear FIFO receive interrupt flag
SCI_enableRxInt(obj->sciaHandle); //Enables SCI Receive interrupt
SCI_setRxFifoIntLevel(obj->sciaHandle, SCI_FifoLevel_1_Word); // FIFO interrupt level
// SCI stop bit, parity, loopback, char bits, idle/address mode (SCICCR = 0x07)
SCI_setNumStopBits(obj->sciaHandle, SCI_NumStopBits_One);
SCI_setParity(obj->sciaHandle, SCI_Parity_Odd);
SCI_disableParity(obj->sciaHandle);
SCI_disableLoopBack(obj->sciaHandle);
SCI_setMode(obj->sciaHandle, SCI_Mode_IdleLine);
SCI_setCharLength(obj->sciaHandle, SCI_CharLength_8_Bits);
// TX enable, RX enable, RX ERR INT enable, SLEEP, TXWAKE (SCICTL1 = 0x03)
SCI_disableRxErrorInt(obj->sciaHandle);
SCI_disable(obj->sciaHandle);
SCI_disableTxWake(obj->sciaHandle);
SCI_disableSleep(obj->sciaHandle);
SCI_enableTx(obj->sciaHandle);
SCI_enableRx(obj->sciaHandle);
// TXINT enable, RXINT enable, TXEMPTY, TXRDY (SCICTL2 = 0x03)
SCI_enableRxInt(obj->sciaHandle);
SCI_disableTxInt(obj->sciaHandle);
// SCIH-SCIL BAUD - SCI_BAUD = (LSPCLK/(SCI_BRR*8)) - 1
SCI_setBaudRate(obj->sciaHandle, SCI_BaudRate_9_6_kBaud);
// Reset SCI
SCI_enable(obj->sciaHandle);
PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX);
CPU_enableInt(obj->cpuHandle, CPU_IntNumber_9);
} //End of Setup SCI function.
--------------------------------------------------------------------------------------------------------------------------------
In hal.h
extern interrupt void mainISR(void);
//JEDL HV Drive
//Nikhil Bapat
//SCI Interrupt
extern interrupt void sciaISR(void);
static inline void HAL_initIntVectorTable(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;
PIE_Obj *pie = (PIE_Obj *)obj->pieHandle;
ENABLE_PROTECTED_REGISTER_WRITE_MODE;
pie->ADCINT1 = &mainISR;
//JEDL HV Drive
//Nikhil Bapat
pie->SCIRXINTA = &sciaISR;
DISABLE_PROTECTED_REGISTER_WRITE_MODE;
return;
} // end of HAL_initIntVectorTable() function
-----------------------------------------------------------------------------------------------------------------------
I suspect that I might have missed something in setting up the SCI Interrupt function. Any help would be appreciated.

