2011-08-12 10:06 AM
Hello.I have a problem with starting OTG FS in Device mode.
I will try to adapt project example ''STM32_USB-FS-Device_Lib_V3.3.0'' for this STM32F-2 chip, but USB doesn't run. For new chip I'll do next: 1. Prepare system_stm32f2xx.c file with ext. crystal 25mHz, 120mHz core, 48mHz for OTG module, flag ''require 48mHz for USB is setted. 2. Change OTG FS clocking enable to next string: _RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ; When I turn ON the clocking for OTG FS module by AHB2, the pin USBDP pulls up but, it looks like okey, but the counter part of HFNUM register (Upper word) will stay stopped. Is it good for this chip? Because when I open the same project for STM32F107RCT6 chip and look on this register after enable OTG clock, the counter in HFNUM will run. Maybe problem is in USB clocking settings? Can I do else for right setup USB clocking except preparing system_stm32f2xx.c? This project maked on my target board.2011-08-15 04:01 AM
My init for FS USB:
GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_OTG_FS);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_OTG_FS);// Configure PA11/12 as alternate function push-pull for USB
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 + GPIO_Pin_12; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure);// Enable USB clock
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ;Regards,
Johannes2011-08-15 10:01 PM
2011-08-16 01:40 AM
The only thing that caused problems for me was that I had not connected VBUS to PA9 so I had to set NOVBUSSENS in GCCFG. Therefore I modified the OTG controller init code in the lib. But that was the only thing that caused problems (as far as I remember at the moment).
Hope this helps, Johannes2011-08-16 02:46 AM