imxrt-rs / imxrt-hal

Rust for NXP i.MX RT
Apache License 2.0
133 stars 33 forks source link

Initializing the SRTC crashes the board #150

Closed therealbstern closed 8 months ago

therealbstern commented 8 months ago

This is on a Teensy 4.0 using teensy4-rs.

When I initialize the SRTC, the code stops running.

A minimal example is at https://github.com/therealbstern/srtc-error

This worked with teensy4-rs 0.3 and imxrt-ral 0.4 but doesn't work with teensy4-rs 0.4 and imxrt-ral 0.5.

mciantyre commented 8 months ago

This issue doesn't reproduce using the hal_srtc example in this project, so it looks like the issue is in the BSP. Could you give mciantyre/teensy4-rs#154 a try? I think this patch directive in a Cargo.toml file should work:

[patch.crates-io.teensy4-bsp]
git = "https://github.com/mciantyre/teensy4-rs"
branch = "snvs-hp-cg"
therealbstern commented 8 months ago

I will give it a try and report back. Thank you for your help!

therealbstern commented 8 months ago

That fixed my test case. I think my bigger program also works, but I have to set up a different debug rig to test it.

mciantyre commented 8 months ago

Thanks for testing. I released teensy4-bsp 0.4.7 with this fix. I deleted the snvs-hp-cg branch in the teensy4-rs repo, so that patch directive might not work anymore.

If you notice any other problems, open issues here or in the teensy4-rs project.

therealbstern commented 8 months ago

FYI, my more complicated program crashes any time I call a macro, but that's clearly something else. Thanks again!