2014-01-02 11:17 PM
hi,
maybe someone can help me. I want test the USB-HS on my board and take the example code from the ST Homepage. After the elimination of all compiler errors and declartion of the defined Symbols, the code stops in the startup_stm32f4xx.c file, at this function
static void Default_Handler(void)
{ /* Go into an infinite loop. */ while (1) { } }I work with coocox. Can someone help me with this problem or does anyone have the code for the USB-HS and can share with me?
My compiler control string is: -mcpu=cortex-m4; -mthumb; -Wall; -ffunction-sections; -g; -O0; -DSTM32F407IG; -DSTM32F4XX; -DUSE_STDPERIPH_DRIVER; -D__ASSEMBLY__; -DUSE_USB_OTG_HS; -I.; The code you find in the attachment. Thanks2014-01-06 07:14 AM
hi,
first I want a correct connection to the PC, later I can change the code as I would like it. The problem with the /* Go into an infinite loop. */ still exists :\2014-01-06 07:23 AM
Then figure out why you end up in the Hard Fault handler!
The processor creates a stack context, and system registers that can point you at the failing code. Examining this with current register settings can help understand the reason it got there. Especially withstupid
tools like CooCox which breaks the CMSIS, you'll want to pay specific attention to when/if SystemInit() is called. The the FPU is enabled, and the stack is adequate. Classic reasons you might Hard Fault, reads/writes to the wrong memory, lack of require IRQ Handlers, too small or corrupted stack, linking with 32-bit ARM library code.2014-01-06 07:59 AM
one step further.
I change the code in the usb_bsp.c from the USB_OTG_BSP_uDelay into void USB_OTG_BSP_uDelay (const uint32_t usec) { //#ifdef USE_ACCURATE_TIME // BSP_Delay(usec,TIM_USEC_DELAY); //#else __IO uint32_t count = 0; const uint32_t utime = (120 * usec / 7); do { if ( ++count > utime ) { return ; } } while (1); //#endif } and the 'USB_OTG_BSP_mDelay' into void USB_OTG_BSP_mDelay (const uint32_t msec) { //#ifdef USE_ACCURATE_TIME // BSP_Delay(msec,TIM_MSEC_DELAY); //#else USB_OTG_BSP_uDelay(msec * 1000); //#endif } and now it doesn´t go into the infinite loop. But the PC is still not find the connection. Only a unknown device :\2014-01-06 08:16 AM
Hi
Silly question - do you have the VCP port driver installed on the PC? ''But the PC is still not find the connection. Only a unknown device'' Check the clock configuration! THe USB peripheral is VERY clock sensitive. The USB peripheral MUST be clocked from a relatively accurate 48MHz - this can be derived from the system clock but it must be relatively accurate.2014-01-06 11:03 PM
hi,
the VCP driver are installed. Today I check the clock. The erroris
probably only a
trifle
2014-01-07 05:12 AM
it works.
I forget to include the extern uint32_t USBD_OTG_ISR_Handler.if
anyone is interested
, here is the
code
________________ Attachments : USB-HS2.ZIP : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0v4&d=%2Fa%2F0X0000000bfb%2FOtEU.8eCHv59gfjDnU8yD1YY.FQ6q2fyWKQ.ZUUjtgo&asPdf=false