fx3 usb stack reset

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

cross mob
Anonymous
Not applicable

I dont know if there is a way to reset the fx3 device without disconnecting from the usb host. Just doing a usb stack reset, is there any way to achive that?, I noticed in my application that works for the very first Gpif2 transaction but after that, and after reset the dma channel, endpoint, etc there is no way to take the app works again, sometimes its works 3 times, sometimes 8 times, but finally it crash. So again anybody know a safe way to restore the device and the usb stack to initial condition, thanks.

   

 

   

(I follow the lines includes in the troubleshotting guide about the way to reset dma channel keeping the endpoint in nak state.)

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

To reset your USB Pipe:

   

1) Call CyU3PGpifDisable (CyTrue); (in case you are transferring data between USB and GPIF)

   

2) Call  CyU3PUsbSetEpNak (EndPoint Number, CyTrue); //To Set the endpoint in Nack condition

   

3) Put a small delay :                     CyU3PBusyWait (100);

   

 

   

4) Reset the DMA Channel (or channels) assosicated with USB                    

   

CyU3PDmaMultiChannelReset (&ChannelHandle);

   

5) Flush the endpoint and release the nack

   

  CyU3PUsbFlushEp (EndPointNumber);
                    CyU3PUsbSetEpNak (EndPointNumber, CyFalse);

   

 

   

When again starting the streaming again, please ensure that the CyU3PDmaChannelSetXfer, CyU3PGpifLoad and CyU3PGpifSMStart are called in the order.

   

There is also a warm reset in FX3 in which the firmware is loaded from the beginning again.

   

You need to call CyU3PDeviceReset (CyTrue); Before calling this, you need to de-initialize all the blocks that are enabled.

   

For example CyU3PConnectState (0,0); // for disabling USB

   

CyU3PUartDeInit (), CyU3PPibDeInit () to de-initialize UART, PIB Blocks etc.

   

Regards,

   

- Madhu Sudhan

0 Likes