-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Observed on an raspberry pi pico 2040: I tried to write a simple program which reads from a DS18B20 and writes the temperature to an SH1106 display via i2c. The onewire code was mostly copy&paste from https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/pio_onewire.rs . I could not get my program to run, only very seldomly the DS18B20 got detected and a few reads succeeded. The same hardware worked flawlessly when using MicroPython.
After a while i figured out that my program works in --release mode, but not when compiled without --release flag, even when no debugger is attached.
I found that the same holds true for the above mentioned example from the embassy repo. It works only when compiled with the --release flag.
- It would be nice if most example code works in debug mode, allowing to attach a debugger. Of course there might be circumstances when this is simple not possible, but this should be mentioned in the examples. (That time critical code does not work with breakpoints in the wrong places is understood.)
- In this particular case i cannot figure out the reason why --release or debug makes a difference, as the time-critical signals are generated by the PIO, which should not be affected. As far as i understand the rest of the onewire timing is not critical (i.e. everything except single bit transfers). Is there an obvious stupid reason i don't see?
- Even more: As the central functions for statemachine communication (wait_pull and wait_push) are asynchronous, the performance of the main code should not matter at all, as additional tasks will likely break critical timing outside the PIO.
Metadata
Metadata
Assignees
Labels
No labels