cancel
Showing results for 
Search instead for 
Did you mean: 

USB (VCP) disconnect problem - STM32F207ZE

konoppo
Associate II
Posted on August 07, 2012 at 12:11

I have got the VCP Example from STM32 USB OTG HOST-DEVICE library running on my STM32F207ZE. The example was pasted into my project with small modification - it don't get data from UART port, but application simply puts data into APP_Rx_Buffer. 

The problem: when I disconnect USB cable (even if port is closed) the MCU halts. The debug also stops to work! I can't access my MCU usuing neither OpenOCD+Olimex ARM-USB-OCD-H JTAG nor ST-Link Utility + ST-Link/v2. I can't halt MCU Core, read registers etc. I can only press hardware reset button on my board. So it's impossible to check where exactly program halts. 

What I noticed? If I make sequention:

- halt MCU core

- disconnect USB cable

- run the core

the everything is OK. 

The situation doesn't chagne if I don't send anything through USB (I cut out all writes to APP_Rx_Buffer). 

Could you help me where I can find the problem? What should I check or correct? 

Best regards

#usb-stm32f2
1 REPLY 1
konoppo
Associate II
Posted on August 09, 2012 at 15:29

Problem temporarily solved. In function DCD_HandleUSBSuspend_ISR() there is a line:

    /* Request to enter Sleep mode after exit from current ISR */

    SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk);

This line causes the MCU go sleep. After changing configuration of USB_OTG everything is OK. 

Best regards

Konoppo