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

cross mob

Lost buffers in Bulk IN transfer using the AN2135SC

Lost buffers in Bulk IN transfer using the AN2135SC

Anonymous
Not applicable
Question: When EP_Pair example is modified to implemenet a bulk IN example, all blocks received at PC start with 0x04 after reset (power on, 8051 sw download). What can be the reason?

 

Answer:



Please note that most people do not implement a block counter in the firmware for bulk transfers. The counting is done on the host application side.

Nevertheless, what's happening is that by the time the code starts running, it actually processed two INs already, incrementing the count by 4 (it's 4 because the IN endpoint is double buffered). If you disable the double buffering, you'll see 2 for the block counter.


What is happening is that the host is actually requesting INs before the device has been fully configured. Thus, to prevent that from happening, add a flag called enable_in, which is set in the DR_SetConfiguration() function. When the device has fully been enumerated by the host, this function will be called. The enable_in flag is set here to be TRUE, and the TD_Poll function can now process the INs from a "ground-zero" state. The block counter now starts from 0 and increments after every IN pressed from the EZ-USB Control Panel.


Please also reference page 10-6 of the EZ-USB Tech. Ref. Manual. Notice the effects of a bus reset. What you're seeing in 3) may potentially be a side-effect of this.

0 Likes
183 Views
Contributors