USB - using endpoints with ping-pong attributes (dual bank)

"Warning: When RX_DATA_BK0 and RX_DATA_BK1 are both set, there is no way to determine which one to clear first. Thus the software must keep an internal counter to be sure to clear alternatively RX_DATA_BK0 then RX_DATA_BK1. This situation may occur when the software application is busy elsewhere and the two banks are filled by the USB host. Once the application comes back to the USB driver, the two flags are set."

However, the same datasheet says that register UCP_CSRx has a bit called DTGLE (Data toggle) which is described as "Read-only

0 = Identifies DATA0 packet. 1 = Identifies DATA1 packet." which suggests that bit DTGLE may be used as the modulo-2 counter that we needed.

So, looks like I don't need to keep an internal counter, as the first paragraph suggests, and that the chip itself keeps track of that counting in bit DTGLE. Is this right? For me, it makes no sense to ask the software keep track of something that is already tracked by the UDP itself (the UDP knows perfectly which of the two banks wrote data to, on its last operation).

However, I haven't found not even one source code example using DTGLE. Very strange.

Has anyone used UDP_CSRx.DTGLE?

Thank you, Bill

Reply to
Bill
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.