Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I am using Isochronous USB to transfer data from the PsoC5LP Devkit to a host PC. If, I sit in a tight loop loading the endpoint with data, the host receives everything intact. In my application, I will not be able to sit in a tight loop feeding the end point as I must wait for data to be created before I can send it. It takes 10s of ms to generate enough data to transmit.
If I load the endpoint with data, delay a few ms, then load the endpoint with new data and delay a few ms, then the data received by the host is corrupted, I believe that the issue is caused by new data being loaded into the endpoint while data is being sent over the USB bus. I need a way of knowing when my Isochronous USB transfer has finished that way I can set the endpoint's paylaod length to 0 while I am waiting for new data to be created. Also, I need a way of knowing when it is safe to load the endpoint with new data, as it seems to me that there could be an issue caused when loading new data into the endpoint. I am imagining issues popping up with the USB endpoint being halfway loaded with new data and a USB data request coming in from the host.
USBFS_GetEPState and USBFS_IN_BUFFER are the function and register I need to check for my specific host application. I am using the USBFS_GetEPState function to check if the endpoint is empty before loading in data, and again to check to see if it is full before making the endpoint have no data. This ensures the host program reads the new data once and receives nothing until new data is ready. Below is the section of code completing this task.