11 years, 8 months ago.

SPI and MODSERIAL ISRs seem to clash

I am reading an IMU serial device on an SPI and a GPS serial using a MODSERIAL class. I have a "dataReady" signal line on the IMU that I use to generate an interrupt. I just let the GPS bytes build up in the MODSERIAL buffer (that is sized at 1024) to catch the GPS serial bytes. I flush the MODSERIAL buffet at the occurrance of a GPS 1PPS event. When I disable the SPI ISR I get all the GPS bytes. When I turn on the SPI ISR I miss several GPS bytes each second. The GPS serial rate is 11520baud and the SPI clock is 1000000.

It seems the ISRs for these two serial streams are clashing. Any suggestions as to the options would be helpful.

- Jim

1 Answer

11 years, 8 months ago.

Your SPI ISR is then an interruptIn ISR, that uses SPI? And not actual SPI interrupt I assume? Can you either post your code between <<code>> and <</code>> here, or if it is alot just publish the program and link to it? I would say the most logical problem is that you simply spend too much time in the interrupt handler of your IMU, although with that difference in clock speeds + the FIFO buffer of the UART I wouldn't really expect a problem.

And how often does your IMU generate an interrupt?

thanks ... i believe the issue is, as you say, the time in the ISR. I was reading the SPI registers in the ISR. I redid this to set a flag and do the register reads in the main while(1) {}. This seems to have solved the problem. The IMU (ADIS16488) has a "dataready" IO line that i am using to trigger the ISR. I am operating the IMU at 100Hz.

posted by james kain 28 Mar 2013