I'm trying to port the code I wrote on simulator on a HR+ sensor, and I'm facing an issue I didn't have on simulator.
The code tries to write a quite large buffer (7.5KB) on EEPROM using Whiteboard's EEPROM API by splitting it in 16 bytes long temporary buffers, calling asyncPut
and busy waiting for completion (onPutResult
sets a flag) before writing the next chunk.
After a few thousands iteratations (it doesn't always fail at the same iteration) execution stops with this message I'm getting through RTT: 860:Whiteboard.cpp
I think it's an assertion failure. Are there more info available on this error? What am I doing wrong? Is my approach for writing large amounts of data the right one?
ASSERT on line 860 of the Whiteboard.cpp gets triggered when the sensor cannot handle a notification from a subscription in a timely manner. I did notice a "red flag" in your description: "... and busy waiting for completion ..." which is probably the reason for it.
The Movesense framework is fully asynchronous which means that any kind of busy-looping is strictly forbidden since it prevents normal operation of the sensor (like the above notification handling).
To avoid busy looping, trigger the next asyncPut in the onPutResult() callback and make sure to specify the AsyncRequestOptions::ForceAsync option to the call.
Full disclosure: I work for the Movesense team