cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-F3-Discovary USB-FS example stuck

boaz
Associate II
Posted on October 01, 2014 at 11:32

I've tried running the USB example from the Discovery sample library, out of the box.

The issue is that once interrupts are enabled (by calling usb_pwr.c/PowerOn()), the MPU gets keeps calling the USB_LP_CAN1_RX0_IRQHandler() ISR, and the program is stuck.

Any ideas?

Technical details:

  • STM32-F3-Discovary board with STM32F303VCT6
  • STM32F3-Discovery Board Firmware Applications Package, version

    V1.1.0 / 20-September-2012

  • Tasking IDE, on Windows 7 64-bit

#discovery #stm32f3 #usb
2 REPLIES 2
tsuneo
Senior
Posted on October 01, 2014 at 16:44

How about the ''OSC clock supply'' of your board?

The USB examples (Demonstration and Peripheral_Examples\USB_Example) in the package (v1.1.0) expect 8 MHz from ST-Link

system_stm32f30x.c
/* Select the PLL clock source */
//#define PLL_SOURCE_HSI // HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source
//#define PLL_SOURCE_HSE // HSE (8MHz) used to clock the PLL, and the PLL is used as system clock source
#define PLL_SOURCE_HSE_BYPASS // HSE bypassed with an external clock (8MHz, coming from ST-Link) used to clock
// the PLL, and the PLL is used as system clock source

To satisfy this setting, you may need to change the solder jumpers on the board, according to this chapter of the User manual of this board. http://www.st.com/st-web-ui/static/active/jp/resource/technical/document/user_manual/DM00063pdf 4.1 OSC clock supply MCO from ST-LINK. From MCO of the STM32F103C8T6. This frequency cannot be changed, it is fixed at 8 MHz and connected to PF0-OSC_IN of the STM32F303VCT6. Configuration needed: – SB12 closed, SB17 open, R33 removed – SB18, R32, C22, C23, X2 = don't care Tsuneo
boaz
Associate II
Posted on October 05, 2014 at 08:57

Thank you Chinzei, but the clocks are configured OK.

After disabling the SUSPEND interrupt (by removing CNTR_SUSPM from the definition of the IMR_MSK macro in usb_conf.h), my device enumerated OK, but then, of course, it is unable to suspend.

Some more info:

My device has a battery, so it wakes up before the USB cable is attached (I emulate this on the eval board by allowing power from the ST-Link connector).

The moment power is enabled, the USB_LP_CAN1_RX0_IRQHandler() interrupt handler keeps getting called, with the ERR, SUSP and ESOF flags set.

I suspect a problem in the library interrupt handler routine USB_Istr() defined in usb_instr.c - it clears the SUSP flag, but it immediately gets set again, as the cable is disconnected.

Any idea how to tackle this?