AnsweredAssumed Answered

STM32F103RB code OK, STM32F103C8 not OK: alignment?

Question asked by dibbs.stewart on Apr 30, 2015
Latest reply on May 1, 2015 by dibbs.stewart
I have two almost identical 72MHz boards which have code issues I suspect are related. I have DFU firmware that loads on to both boards, and both appear to the host as a USB DFU device.

App firmware is loaded at 0x08003000, with NVIC_Relocate(); to set the jump point.

On the STM32F103RB, I load the DFU code, and erase all the FLASH, then load the app firmware. The board reboots and appears as a fully functional  HID device as intended.

A jumper if fitted causes the board to boot up as the DFU device. If I load the same app firmware again, when the board reboots the app code fails in some way, and the HID device does not appear to the host. Fixing this requires the DFU (with erase) and app reloading.

This is very odd, as the same app binary is loaded at the same address, using the same utility. I would have expected the app to work as before.  It's as though the rewrite/overwrite is failing or writing elsewhere.

On the STM32F103C8, essentially the same app firmware is loaded, with only variations in the GPIO pins activated. I've checked this many times, and can comment it all out to no avail.  The HID device does not appear to the host at all. I can fit the DFU mode jumper and USB DFU mode will restart as intended.

I'm not aware of any major differences between the F103C8 and F103RB other than the flash size. So far as I can tell, the clocks (RCC stuff) are being set properly.

I'm wondering if the code alignment is the issue. Some experiments with #pragma data_alignment=4 have had no effect.

All ideas and suggestions are welcomed.

Outcomes