-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timing issue in configuration. #9
Comments
We've noticed similar issue as well, but only when compiling with Does compiling with |
I just checked, it happens to me with this:
I will test the Z and 3. I will check the linked bug, it might see something interesting with the logic analyser. |
https://github.com/nraynaud/pill-rust-test/blob/master/src/main.rs#L322 |
@nraynaud Yep, I tried something along these lines as well (but only for opt-level3, as I haven't seen any issues with lower levels). I'm still not sure whether it's an issue with non volatile write somewhere, that gets reordered or timing issue (i.e. NSS pin changes state while data transfer in progress). Perhaps in mpu driver we should poll for transfer status and only toggle NSS pin when it's done, but that seems sub-optimal. I also think that this low level details should be handled by HAL implementation crate, as on some boards you can delegate nss control to hardware, afaik. |
for me it's also a problem with O2, and I need optimization because I really don't have a lot of slack in the timing. I don't have an oscilloscope to check the SPI protocol against a reference. |
I've been having a similar problem in Adding the following to my Cargo.toml got the device working again: [profile.release]
opt-level = 'z' |
@romixlab what version do you use? I've added noinline attribute to write, but it seems we should just use compiler or memory barrier around ncs manipulations :-( Btw, I think calibrate_at_rest should be deprecated, or reimplemented, as it re-initializes device and changes setting. I think we can do it better %) |
I'm using 0.11.0 |
I ran into this issue recently when trying to use SPI with an RPi Pico W board. I was running into the issue when trying to use the As an aside, I do not see anything wrong with the current |
When using a DMA SPI peripheral, there is no delay between the write and the reads, this leads to some configuration error. The MPU basically never goes into running mode and never sends the interrupt.
I could not pinpoint the exact problem, so I resorted to adding a delay before every write:
This happens wether the SPI clock is a 200kHz or at 500kHz.
I am struggling to find which exact timing condition is violated in the datasheet.
The text was updated successfully, but these errors were encountered: