cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 USB Register h file?

tescaflown
Associate II
Posted on December 24, 2015 at 04:11

Hello,

I use the STM32F103C8T6 to practice.

I got the stm32f1-stdperiph v3.5 as include files.

Now, I try to do my fisrt step to make work the USB peripherial. My problem is I didn't find any easy struct access to the USB register in ''stm32f10x.h''

I mean, during all my learning test, I always able to access to any register with something like this for instance:

TIM1->PSC =xx or RCC->APB2ENR |=xx, etc

I sought inside all h file, but no struct access for USB. For instance, to access to CNTR register, I can not write:

USB->CNTR=. I have to write *((uint16_t*)(0x40005C40))=

is somebody can say me whether there is a h file where all the USB registers are defined in struct pattern? 

Thanks for your help.

3 REPLIES 3
tescaflown
Associate II
Posted on December 24, 2015 at 17:14

Perhaps the IP used doesn't lend itself to a tight structure definition. If you need one, make one.

ST provides an abstraction, rather than a structure

STM32_USB-FS-Device_Lib_V4.0.0\Libraries\STM32_USB-FS-Device_Driver\inc\usb_regs.h

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tescaflown
Associate II
Posted on December 28, 2015 at 07:49

Yes, this file contains no structure easy access to register. And you right, it makes no sense to this. USB interface needs some special access to packet memory area (16bits wide but accessed with 32bits address) and the Endpoint register EPnR has some toggle bit only making impossible to use structures. It's like an external device inside the ship. I just got it worked. thx

bye