After a great deal more debugging, I finally got something running on the lerdge. To begin with, I saved off the PC register and VTOR addresses to make sure my settings were correct, or at least matched what the board expected.
Not surprisingly, they were right.
After a bunch of debugging, I followed the chain of functions from start to the static init function, which is actually where the clocks are configured (which is odd - you'd expect them to be earlier in case another initialier needs to delay). It may be that there's code that forces the init to happen first.
But here's the thing - the board was hanging because I was re-initializing everything, and it was already running. And SWD on STM32 chips does not run well without a clock signal. The ST link reported "unknown chip id", something it won't do even if you refuse to enable anything.
In STM32DUINO there are some warnings in the clock initialization code that an error there can leave the system without a functioning clock and those are not idle messages.
Solution? Remove main clock init. After checking, most of the peripheral clocks are configured correctly anyway, and I can initialize the others. Just don't mess with the primary clock source once the board is up and running.
After I did this, I uploaded a mildly modified blink sketch..and got this:
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.