AnsweredAssumed Answered

USB Attach/Detach Problem

Question asked by Eric Dyke on Dec 1, 2015
Latest reply on Jan 16, 2016 by TomE

Hi all,


I'm using the MCF51JM128. have two sections of code that run independently.  Each section is created as a different CW project using Processor Expert.  The first code section is a bootloader that reads from a USB thumbdrive and re-flashes the second main application section.  This bootloader uses the USB host stack. I jump from one section to another at the "_startup" address to supposedly initialize everything appropriately.


Normally, after a hard power cycle, the bootloader runs first and checks to see if a re-flashing is required.  If no re-flashing is required, it will immediately jump to the main application section. Within the main application I do not use the USB stack. I only monitor the USB attach bit in the INT_STAT register via the interrupt to determine if the user has inserted or removed a thumbdrive to bring up a "software update screen".  In this scenario, the attach/detach detection works fine.


The problem arises when the bootloader does a re-flashing and then jumps to the main application.  In this scenario, I continually get an attach event interrupt with or without a thumbdrive inserted (I do clear the interrupt by writting to the INT_STAT register each time).