Hello,
I have an external chip in SPI slave mode and connected to 52840 through SPI interface. When data is ready it will notify 52840 through its dedicated IRQ pin (connected to one of GPIO of 52840), and then 52840 will read the data back through SPI bus., using SPIM driver.
the software is composed like this:
1. Setup GPIOTE to sense the GPIO/IRQ pin (low to high)
2. in GPIOTE interrupt handler, use app_scheduler to transfer execution to main context.
3. in main context, use SPIM driver to read data back to 52840's RAM.
the above process can run fine and the data read back are all correct. However, a problem is Step 2. has a large delay about 2ms. that is, after app_sched_event_put is called, the data event handler is executed only after 2ms. My application can not tolerant such big delay.
Is this delay normal? if not, what could be the possible reason why it happen?
Major code snippet:
Main.c
GPIOTE init:
GPIO interrupt handler
app scheduler event hander: