FX2 re-enumeration (USB-plug/unplug)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hi,

   

I'm trying to understand exactly what happens when the FX2 has power but the USB is unplugged and then re-plugged back in.   Our firmware uses the vend_ax example as skeleton code.   I had thought originally that if the user unplugs the USB cable and plugs it back in (power is supplied separately; not through USB) that TD_Init() would be called again.  However, that appears to not be the case.  I understand that when the USB is unplugged the FX2 will go into sleep mode and that it "wakes up" when the USB cable to the host is plugged back in.  

   

My issue is, given how our FX2 and FPGA are integrated, I need to send a signal from the microcontroller to reset the FPGA when this re-enumeration event happens and I'm not sure what routine will be called once when the USB cable is inserted. I found somewhere that TD_Init() is called when "re-enumerating a new device" but apparently unplugging and plugging in USB cable connecting to the host is not that event?

   

Any wisdom welcome!

   

-Hyped

0 Likes
3 Replies
Anonymous
Not applicable

 Hi,

   

 

   

When FX2 is operating in self powered mode (i.e. external power supply; not VBUS), if you want to interrupt FPGA whenever renumeration happens, you can make use of SET_CONF request. Upon completion of enumeration SET_CONFIGURATION request will be issued by the host. You can set some flag or notify the FPGA when SET_CONF request is received.

   

Or you can even use a GPIO to monitor VBUS in TD_POLL.

   

 

   

Regards,

   

Gayathri

0 Likes
Anonymous
Not applicable

 Hi Gayathri,

   

Thanks for your response! So in vend_ax.c there is a DR_SetConfiguration stub:

   

 

   
BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received{ Configuration = SETUPDAT[2]; return(TRUE); // Handled by user code}  I should be able to just add the FPGA reset command in here, correct?  Out of curiosity, I was wondering whether one could include the FPGA reset in the fw.c wake-up interrupt handler stub:  // Wake-up interrupt handler void resume_isr(void) interrupt WKUP_VECT { EZUSB_CLEAR_RSMIRQ(); }

   
Thanks! Best, Scott
0 Likes
Anonymous
Not applicable

 Hi,

   

 

   

I have not tried the wakeup interrupt handler so far. I will have to check on that. Did the other oprion of Set config request work?

   

 

   

Regards,

   

Gayathri

0 Likes