EmbeddedRelated.com
Forums
Memfault Beyond the Launch

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

Started by Bill November 19, 2008
Hi,

The datasheet for the AT91SAM7X256 says:

"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


Memfault Beyond the Launch