Problem with SPI bus in XIRQ interrupt

Started by ymliao March 4, 2009

I use MC9S12E128 micro in my application, and XIRQ interrupt to handle power fail.

In the XIRQ interrupt, I need to save data to memory via the SPI bus. And I notice that sometimes the SPI bus is not working properly:

1) data appears on the bus is not what's being sent by the micro

2) SPI bus clock becomes scrunched up (before power fails, there is some idle time between each group of eight clock ticks when reading/writing a bunch of data on the bus, but after power fails, SPI clock appears one after another, no more idle time)

Has anyone seen this before? Any help is greatly appreciated!