My design is based on S12G128 running at 24M bus clock, and 2 SCI ports are used, 1 of them for downlink communication and another for uplink communication, so it looks like a serial communication bridge.
I'm using CW 5.1 and processor Expert, downlink SCI is configured to 115200 baud and uplink SCI is 19200 baud, both of them are interrupt-enabled and assigned some TX/RX buffer in PE panel.
Uplink received message handling is done in uplink_OnRxChar event, in this event the incomming char is checked and stored to an private buffer, when char count reaches to 5, means a command frame is received, after analysis the frame, a 64-bytes response is sent by calling SendBlock function.
My finding is there are possibility of downlink data loss, especially in downlink RX. By insert GPIO-toggle actions and measuring by oscilloscope, I found calling SendBlock() for 64-bytes will cost around 200~300uS time, this probally causes my problem, because in uplink_OnRxChar event, other interrupt is prohibited unless event/interrupt completed, so during the 200~300uS, probably multiple downlink RX interrupts happened due to high baudrate 115200, but only last one can be served after uplink_OnRxChar event completed.
To resolve the issue, I have to re-enable interrupt before calling SendBlock() by calling __EI() to allow downlink RX interrupt, so downlink RX looks OK, but unfortunately another problem pop up: uplink only TX 63 bytes even I'm calling SendBlock() to transfer 64 bytes.
I'm wondering, can I re-enble interrupt in uplink_OnRxChar event? Can I call SendBlock() in interrupt event? Will this cause un-predictable problem?
Thanks.