AnsweredAssumed Answered

STM32F103RB USB Init in ASM

Question asked by BennVenn on Dec 25, 2013
Latest reply on Jun 25, 2015 by kj.kumaresh
Hello everyone,

I have a 'leaf maple' ARM board which I am trying to get the USB peripheral functioning using only ASM coding. I am fairly confident with ASM in general but only have a few months experience with 32bit ARM MCU's. I don't have any experience with USB so this was going to be a good little project to get familiar with the hardware.

So far, I have all the clocks initialised and running at the speeds suggested in the datasheet, the USB interrupts are set and running fine. Upon the hardware requesting a reset, a USB reset is initiated, the hardware then calling 'SOF' interrupts. From what i've read in the USB standard, the host is requesting information or providing an address however I cant find where the USB hardware is dumping its data.

I've read and re-read the datasheet, setting the Base address to 0x0000 which should (from what the datasheet suggests) point the hardware to 0x40006000 to find the endpoint buffer configuration. Here starts the problem. I cant write to this area. I thought this could be a problem with APB1 configuration but can't see anything wrong.

I loaded the HID demo code and the hardware enumerates in windows fine. During debugging with the demo code loaded, the address from 0x40006000 are all set to 0x00's. The endpoint configuration is clearly not there, nor the buffered data. It seems the buffered data appears around the start of the SRAM, 0x20000000 but I cant see where the init code is pointing to that address.

So my first question is: Where does the STM32F103RB store its configuration data? I'm sure it is something simple that I have overlooked, but trying to debug and compare with the demo code - not written in ASM has wasted around a week, and i've gotten nowhere!!! Frustrating!

Any advice would be welcome. I've scoured the forums however most posts are related to the demo code, which is working fine. PLEASE HELP!

-Ben

UPDATE!

Looks like Keil cant view the contents of the USB/CAN buffer area. I added a routine to the demo code that dumps the 512bytes from 0x40006000 to 0x20000000 and there it all was! Finally a way ahead! Sure would be nice if I could see whats going on in that area...

Outcomes