In my application I am trying to run a measurement process as quickly as I can.
The process involves sending a command via SPI to an external IC, listening for an interrupt from the IC indicating the measurement is complete (which is usually ~30ms later), and then reading it back. When this process is completed I start another measurement by calling imp.wakeup(0,takeMeasurement). I buffer up 30 of these measurements and send them in a batch to the agent to do other stuff. That batch transfer happens about once a second currently.
I believe the processor should be yielded after the SPI command is sent (my code thread ends at that point), and when I call imp.wakeup().
What I see is the process will run just fine for a little while, and then the device will drop offline. I have RETURN_ON_ERROR set, so sometimes it comes back up, but I have also seen “[Exit Code] imp restarted, reason: wifi outage” as well.
So far I have tried:
-
Just sending a server.log message periodically to verify its not just that the wireless is bad here and it sometimes drops. The device has not disconnected in that setup.
-
changing to imp.wakeup(0.02, takeMeasurement)
-
Increasing the transmit buffer size with imp.setsendbuffersize()
Is there something fundamentally wrong with the paradigm I am using?
Thank you very much for your time!