MRT and SCT interrupt handling on LPC812

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by matterama on Wed Jan 08 17:30:16 MST 2014
Hi all,

Just wanted to get some thoughts on it some odd behavior...

I have an SCT configured that is reading in a pulse train that has typical pulse transitions occurring at 1 millisecond.  Works great.

I also have an MRT configured to perform a software serial port output.  I am outputting data on that bus at an off-nominal baud rate (100 kbps).  I had to do a SWUART because of this off-nominal rate and the fact that the other two UARTS are being used.  Since the fractional baud rate divider on the LPC800 unfortunately applies to all 3 UARTS, unless they are all multiples of each other you are limited.  (The other two ports are running at 57,600 baud).

Every 10 milliseconds an interrupt fires that clears a flag allowing transmission of a 20 byte message out  the SW UART.

To recap:
1) SCT reading 1 msec pulse train sequence
2) MRT firing off at 10 msec allowing output message on the SWUART
3) MRT then firing off at 10 microsecond repetitive timer to output the bits of the message

IN GENERAL, things are working.  However, the output byte stream sometimes (every 1 to 3 seconds) gets corrupted in a peculiar way.  The bit widths should be 10 micro seconds.  Sometimes it looks like there are inadvertent 10 or 20 microsecond delays that occur.

If I turn off the SCT and output fixed messages on the SWUART, it works fine, no glitches.  And, I've confirmed that the incoming SCT message has no glitches. 

From this, I have to assume there is some issue where the SCT interrupt is being serviced when the MRT interrupt fires off perhaps.  But if this was true, it seems like it should not ever fire off again (the MRT) because the interrupt would not be cleared.

Anyway, anyone have any general thoughts on this or interrupt handling specific to the LPC812?