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
The first commit has src/main.rs as example/blinky.rs. It works as expected.
The second commit replace src/main.rs with example//blinky_timer_irq.rs.rs. This doesn't work. If I look at PC13 with an oscilloscope I can see that it pulses low for only 10us.
The third commit reorders the actions in the interrupt handler, and fixes the issue, with the LED flashing with a 2 second period as expected.
Any suggestions as to what is going on here?
The text was updated successfully, but these errors were encountered:
When I debugged a similar issue, it was extremely strange - e.g. it started working if asm::nop() is called somewhere in the handler, presumably because interrupt routine became more complex and had to store extra registers on stack, and extra RAM access ensured that interrupt had cleared. Adding a bunch of nops that did not affect memory after interrupt clear also did help, and so on.
The document above suggests one of the solutions, and it's exactly what you did - clear interrupt first, and then toggle the LED.
The question is, should HAL try to mitigate this in clear_update_interrupt_flag() and similar functions...
examples/blinky_timer_irq.rs
doesn't work for me. I know how to fix it, but I don't understand why my fix works.My test repo:
https://github.com/timbod7/stm32f1xx-hal-testing
demonstrates the problem using a blue pill board.
The first commit has
src/main.rs
asexample/blinky.rs
. It works as expected.The second commit replace
src/main.rs
withexample//blinky_timer_irq.rs.rs
. This doesn't work. If I look at PC13 with an oscilloscope I can see that it pulses low for only 10us.The third commit reorders the actions in the interrupt handler, and fixes the issue, with the LED flashing with a 2 second period as expected.
Any suggestions as to what is going on here?
The text was updated successfully, but these errors were encountered: