Hi there,
I have had up till now very stable UART communication going from the F280025C to a UART screen using TX FIFO mode and a buffer of 16.
We have also been utilizing CAN in interrupt mode without issue. Our device has been trying to send CAN data every few milliseconds with no secondary CAN device connected and these CAN TX interrupts have not caused any problems.
We have for the first time had to connect a secondary CAN device which has now started to cause problems with our UART comms. Occasionally a CAN interrupt (presumably RX) occurs at the same time as a UART TX and this is causing the messages to get corrupted (presumably the timing is being affected).
What I have tried to do unsuccessfully is turn off the CAN interrupts before a UART TX and re-enable the CAN Interrupt after the UART TX is complete, but I am still seeing the CAN interrupt occur during a UART message transmission. I verified this by toggling a GPIO at the beginning of a CAN interrupt and it is toggling during a UART TX.
Could you please assist by looking at my code and checking whether my method is correct? The function which is called (ready_tx_interrupt) when there is data to send to the screen looks like this:
void ready_tx_interrupt(void)
{
while(msg_length < 17 && 16 - SCI_getTxFIFOStatus(SCIA_BASE) < msg_length) //new2025
{}
Interrupt_disable(INT_CANA0);
// SCI_interrupt_enable();
sci_interrupt_active = true;//ss
SCI_enableInterrupt(SCIA_BASE, SCI_INT_TXFF);
Interrupt_enable(INT_SCIA_TX);
while (sci_interrupt_active==true) //block
{
//wait for data to get sent
}
if (CAN_renable_okay == true)
{
Interrupt_enable(INT_CANA0);
}
}
In the above code will wait for sci_interrupt_active to become true which is done in the UART interrupt procedure. The UART interrupt procedure looks like:
__interrupt void sciaTXFIFOISR(void)
{
//write some data
interrupt_count++; //block
SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, msg_length); //i is size
Interrupt_disable(INT_SCIA_TX);
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF);
//
// Issue PIE ACK
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
sci_interrupt_active = false;
}
Note that my code does not work at all without Interrupt_disable(INT_SCIA_TX); in the above function for some reason.
As mentioned even though I have disabled CAN interrupts during this TX procedure they still occur. If I however set CAN_renable_okay to false at any time (it is normally set to true) I see the CAN interrupts dissapear - not sure why this would be the case? IE Why would they only dissapear after an extended period of CAN_renable_okay being set to false?
Thanks in advance for your help with this.

Yellow is UART, Blue is CAN interrupt toggled via GPIO.