June 23, 2024, 07:16:57 AM

USB Device not working on STM32-E407

Started by zbuffer, November 16, 2013, 03:17:34 PM

Previous topic - Next topic

zbuffer

Hello!

I have successfully implemented the CDC USB device on the STM32-P407.
I wanted to load the same program into the STM32-E407 board because the uC is identical.
I am powering the board through USB. I use the USB OTG2 because it is connected to the HS core like the one on STM32-P407.

Surprisingly It doesn't work! How is it possible? Same uC, same peripherals, same code.....

Regards

Lurch

#1
If the P407 board is not exactly like the E407 board, I think you had better check the pins again.  I haven't used the board for some time, but I have this in one of my header files that I include for H407 / E407 boards in Cross Studio:

#ifdef  STM32_E407
#define USB_FS_VBUSON_PIN        GPIO_Pin_0
#define USB_FS_VBUSON_PORT       GPIOB
#define USB_FS_VBUSON_CLK        RCC_AHB1Periph_GPIOB
#define USB_FS_VBUSON_SOURCE     GPIO_PinSource0

#define USB_FS_FAULT_PIN         GPIO_Pin_1
#define USB_FS_FAULT_PORT        GPIOB
#define USB_FS_FAULT_CLK         RCC_AHB1Periph_GPIOB
#define USB_FS_FAULT_SOURCE      GPIO_PinSource1
#else
#define USB_FS_VBUSON_PIN        GPIO_Pin_10
#define USB_FS_VBUSON_PORT       GPIOA
#define USB_FS_VBUSON_CLK        RCC_AHB1Periph_GPIOA
#define USB_FS_VBUSON_SOURCE     GPIO_PinSource10

#define USB_FS_FAULT_PIN         GPIO_Pin_6
#define USB_FS_FAULT_PORT        GPIOB
#define USB_FS_FAULT_CLK         RCC_AHB1Periph_GPIOB
#define USB_FS_FAULT_SOURCE      GPIO_PinSource6
#endif
....
#ifdef  STM32_E407
#define USB_HS_FAULT_PIN         GPIO_Pin_11
#define USB_HS_FAULT_PORT        GPIOF
#define USB_HS_FAULT_CLK         RCC_AHB1Periph_GPIOF
#define USB_HS_FAULT_SOURCE      GPIO_PinSource11
#else
#define USB_HS_FAULT_PIN         GPIO_Pin_5
#define USB_HS_FAULT_PORT        GPIOB
#define USB_HS_FAULT_CLK         RCC_AHB1Periph_GPIOB
#define USB_HS_FAULT_SOURCE      GPIO_PinSource5
#endif

zbuffer

I am not using VBUSON and FAULT pins.
What I noticed is that these are in fact different. There is also a difference in the usb power chip. But....it doesn't change anything....even if I set 1 on VBUSON.
Other pins must be the same.

Maybe there is some change in serial number of uC which should be somehow reflected in the VID/PID?
I have no idea what can be wrong.

zbuffer

Uohoooo... I figured it out!

The E407 board has got a 12 MHz crystal in stead of a 25 MHz found on P407. I had to adjust the PLL settings to get correct USB clock.