You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the micro:bit V2.2 boards when DAPLink is erasing a flash page if the CPU tries to access flash (e.g. to fetch an instruction) it will be blocked until the erase operation is done.
This affects the processing of serial data from the target to the interface, as DAPLink can be unresponsive for the 87.5ms it takes to erase a page.
So, when using data logging in a programme like this one, with serial mirroring enabled, whenever a page erase is triggered (after logging 4096 bytes) we lose some of the serial mirrored data.
This is also replicable with smaller strings, but then things like I2C "nops" and "null transactions" (which are enabled/disabled depending on multiple factors) can somewhat mitigate this, so this longer string is easier to replicate.
Our current theory is that when writing to a new page MicrobitLog sends the serial data to the DMA or peripheral and then it sends the "erase page" command to DAPLink before all the serial data had time to be sent out of the target.
So once DAPLink starts erasing flash any UART from the target is dropped and that's when we see those issues in the serial output.
One simple solution could be to send the serial data after the DAPLink commands are processed.
Alternatively if there was a wait for CODAL to wait until all the data is out of the target that could work as well.
The text was updated successfully, but these errors were encountered:
Created lancaster-university/codal-nrf52#41 "Add NRF52Serial::pauseTx".
This doesn't delay the logging, BUT... see the comment.
I've tested it by wrapping the erase command in MicroBitLog:
Created #176.
This uses fiber_sleep or target_wait to wait for times calculated from baud rate.
I thought of waiting for CODAL_SERIAL_EVT_TX_EMPTY but wasn't sure it was better or entirely safe.
If the serial.send calls were after the I2C flash commands, this might not actually need to wait, unless logging very fast.
But sending serial while logging to flash probably increases throughput.
With the micro:bit V2.2 boards when DAPLink is erasing a flash page if the CPU tries to access flash (e.g. to fetch an instruction) it will be blocked until the erase operation is done.
This affects the processing of serial data from the target to the interface, as DAPLink can be unresponsive for the 87.5ms it takes to erase a page.
So, when using data logging in a programme like this one, with serial mirroring enabled, whenever a page erase is triggered (after logging 4096 bytes) we lose some of the serial mirrored data.
This is also replicable with smaller strings, but then things like I2C "nops" and "null transactions" (which are enabled/disabled depending on multiple factors) can somewhat mitigate this, so this longer string is easier to replicate.
And in a serial console we'll see and output similar to this extract:
Our current theory is that when writing to a new page
MicrobitLog
sends the serial data to the DMA or peripheral and then it sends the "erase page" command to DAPLink before all the serial data had time to be sent out of the target.So once DAPLink starts erasing flash any UART from the target is dropped and that's when we see those issues in the serial output.
One simple solution could be to send the serial data after the DAPLink commands are processed.
Alternatively if there was a wait for CODAL to wait until all the data is out of the target that could work as well.
The text was updated successfully, but these errors were encountered: