2016-01-21 02:55 PM
Hello guys,
I'm trying to port a firmware that was originally written for a STM32L151 onto a STM32F103. Unfortunately that didn't work although no special hardware peripherals are being used. So I decided to create a template based on the CustomHID examples from the according HAL USB device libraries as a starting point. I threw out all ADC, DMA and special GPIO stuff (except that for USB dis/connect on F103) so that only necessary things remain. The resulting application works like a charm on the L151. Flashing, running, debugging - all without any problem. Unfortunately it's not so easy on the F103. There I can flash it and debug it, but it is not being detected as USB HID as long as I don't disconnect the debugger and cycle the power supply. After doing that it's also detected as HID and behaves exactly as expected. But later I'm still not able to debug it, or better: it's still not being detected as HID when I try to debug it. I'm running GNU ARM embedded 4.8-2014q3 on Win 7 Pro and connect the target via openOCD, STlink v2 (on STM32F4discovery) and SWD. Using a BlackmagicProbe without openOCD leads to the same result. Does anyone have a hint what could be wrong or where I could search for the problem? #usb-customhid-hid-debug-problem2016-01-24 12:52 AM
From the datasheets, I get the impression that the F103 was ST's first ARM microcontroller. They didn't even realize that having a different part number for a different chip was a good idea. You have 103 LD, 103 MD and 103 HD which essentially are different chips with different peripherals.
The L15x is a much more recent chip. Some peripherals have probably been improved /fixed in subtle ways. For example, in the SPI module there was a change in the behaviour of a 16-bit write to the data register. Some STM chips will see two 8bit data elements, others will just use the bottom 8 bits when the datasize is set to the normal 8 bits. If you see differences in the USB peripheral that is where I'd look for changes. Try building an example for YOUR chip and see if it exhibits the same problems as the code you are trying to port from the newer CPU to the older CPU.2016-01-24 11:10 AM
Thanks for your response. I've never seen it from that point of view. But when I think about it that makes sense. I always wondered about the sometimes strange subdivision.
At the moment I'm just trying to get the examples from the according HAL packages running without any additional functionality. Just the USB custom HID part. So to be more specific I'm talking about the STM32F103CB and the STM32L151CB. If someone wants to have a look I have attached the current state. The HAL libs are all unmodified, changes were only made to the files in src and inc. Best regards, Michael ________________ Attachments : HAL-CustomHID_STM32x1xx.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Al&d=%2Fa%2F0X0000000bkv%2FHLfec7H2xlRpAczp.n1AEjlyW3ecR5_WbbYJyPtxYcs&asPdf=false