My goal is to have interrupt or multithreaded driven LSM9DS1 interfacing on the Arduino Nano 33 BLE without stalling the board. Because the interrupt pins on the LSM9DS1 are not connected to the NRF52840 MCU on the board (see green circle in Nano 33 schematic below), I cannot automatically notify the board with updates when the LSM9DS1 FIFO is full and ready for transmission. Also, having a timer that consistently triggers I2C communication with the IMU via interrupt causes the board to stall due to the length of time it takes to communicate.
Is there a way to allow the MBed OS/MCU to allow interrupts to last a prolonged period, or another workaround to provide an interrupt driven LSM9DS1 data capture? Otherwise, this limits the operations that can be conducted to the amount of time the IMU's 32-sample FIFO takes to fill up.
Post the code, using code tags. It sounds like you are making one or more fundamental and fatal mistakes in using interrupts, like trying to do I/O inside an interrupt service routine.
Most interrupts should do nothing more than something like setting a global "data available" flag, and exit.
It sounds like you are making one or more fundamental and fatal mistakes in using interrupts, like trying to do I/O inside an interrupt service routine.
Thanks for the reply. I understand and concur that prolonged interrupts are a bad idea as they may delay other vital operations on the board. That is why I am seeking some sort of way to trigger an IO operation to the board at a particular frequency (lets say for example 50 Hz) with a prolonged interrupt being the worst case. I was wondering if MBed allows some sort of way around this without the need for low-level ISRs. Maybe something similar to task spawning?
Most interrupts should do nothing more than something like setting a global "data available" flag, and exit.
I have used a global availability flag in the past, but unfortunately it would not interrupt main loop operations that last more than the amount of time it takes to fill up the FIFO on the LSM9DS1 IMU.
Due to proprietary conflicts I cannot post a working solution at the moment nor do I believe a solution can exist in the current version of MBed with IO operations in ISRs, but I am wondering in a general sense how to interrupt main loop operations or run IO operations in the background or in parallel to the main loop. This likely must exist at the OS's level.
as getting data from the LSM9DS1 is very simple and fast.
Agreed. And as I look more into the features of MBed. I am thinking that ISR-driven I2C communication is not needed anyway due to MBed's multithreading. Below is a great example: