2015-06-14 11:37 PM
Hey there,
I'm having interesting times with an STM32L151 programming via a nucleo board's integrated SWD debugger (from CooCox ide..... using arm mbed platform too if that helps..) I'm in the interesting position where I've imported some code into my project (initially from an 8051 based project - to setup and configure an Si4463 radio chip) and what happens is, if I use SWD debugger to reset the chip then run the code, it works great... BUT.. if the processor is power cycled, hard reset using the reset pin, or even clobbers itself with the watchdog timer and restarts, then this imported code no longer works right... (the application still runs, just the SPI connected radio IC doesn't get setup right..) Never seen anything like this before - and until today I'd assume SWD reset and run should be the same as a power up or hard reset or watchdog reset... but it's obviously not.. Can anyone explain the differences at the chip level for me? I'm hoping to be able to get this code running right for any reset type, without too much more pulled out hair..thanks! #swd #stm32l1512015-06-15 03:22 AM
Make sure you enable all the peripheral clocks you need, don't rely on the side-effects of the debugger enabling things it needs to function.
Check is there is anything timing critical, the debugger may distort the speed at which things run.2015-06-15 05:47 AM
2015-06-15 06:06 AM
Debugger's are invasive. It's like a kids bike with training wheels, it doesn't drive/turn the same. The real test is whether you can stay upright when they are removed.
If the system doesn't function properly out of a cold reset it's because there's something intrinsically wrong with your code. Either the way it initializes the clocks, or does timing/time-out loops.CooCox breaks the normal CMSIS initialization model, you'd want to watch that.On a hardware level be concerned with BOOTx pin state at reset, and how, and for how long, NRST is driven low.2015-06-15 01:44 PM
2015-06-15 03:45 PM
So... any suggestions as to where I should be bothering people? mbed? ST reps?
ST doesn't participate here very often, and I'm pretty self sufficient. You could push back through the channel to distribution or ST FAE's It's reasonably easy to nuke the mbed stuff out of the Nucleo board. The presence of the USART2 PA2/PA3 as a Virtual COM Port, and the SWV via the SWO pin, do permit progress inside the board to be tracked without and with the debugger active.2015-06-15 07:15 PM
2015-06-15 07:43 PM
I was also interested in removing the usage of MBED for the SPI peripheral I'm using. only issue is I need it for the (properly working every time) library I'm also using for another different radio IC... I wonder how the mbed framework handles me using one peripheral their way, and another directly?