SPI Interrupt when Rx Buffer is half full

Hi everyone,

I want to retrieve an SPI log from another device. This another device is set in master so I want to use my FEZ Panda II in slave mode.

I found that the only way was to do it inRLP. So I began to write something in C and I tried to read periodically the receive buffer but this solution doesn’t work. When the master send 3000 bytes, I can retrieve just one or two bytes on slave side…

So I decided to use the interruption to read the buffer just when the buffer is half full. But I cannot find the IRQ index in the datasheet to install it with RLPext->interrupt.install()

Is it possible to install this interrupt ?

Thanks :slight_smile:

You need to raise event not use interrupts. See RLP extensions.

I don’t understand, the only part that talk about event is the function PostManagedEvent to pass something from unmanaged to managed side.

Did I miss something ?

look at http://ics.nxp.com/products/lpc2000/lpc24xx/#Support
and download the “Sample code bundle” it contains a irq.h file with all interrupt numbers. It also contains samples for most peripherals.

http://ics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc23xx.lpc24xx.uvision.zip

arthur, I think Gus missunderstood…

You need to enable the interrupt for the SPI module that you are using. This is for all interrupts related to that SPI module. This is done with the RLP function as you mentioned.

The interrupt number you are looking for is 10(decimal) for SPI0 and 11(decimal) for SPI1

You also need to select which sub interrupts you want to enable for the SPI module. This is done in SSP0IMSC or SSP1IMSC, bit 2, RXIM.

Then, in your interrupt service routine you must look what the interupt was for, this is done in SSP0MIS or SSP1MIS, also bit 2.

You need the user manual for the LPC23xx, which is on the panda.
http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC2387&type=user

Thanks for these informations very precise. I’ll try to do it right now :wink:

I can’t remember how to reset the interrupt flag though. You need to write a 1 or a 0 to some register.

I suggest you get a kickstart copy of keil-mdk. It is limited to 32KB but that is plenty to debug RLP… :slight_smile:

It has an emulator for the LCP2387 so that you can debug your code and see exactly what is going on. It is a bit of a pain to get the emulator working though, but worth it. I used it to develop my RLP servo driver and it helped me find a lot of bugs…

Just don’t know how you emulate the SPI, but I remember a peripheral menu item for things like that…