how to pad the packet with dummy data

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

cross mob
Anonymous
Not applicable

  If the master wants to send a stream of data whose length is not a multiple of 512, the last packet is not be automatically committed to USB because it is smaller than 512 bytes. To commit that last packet, the master can do one of two things: It can pad the packet with dummy data in order to make it exactly 512 bytes long, or it can write the short packet to the FIFO, then pulse the PKTEND pin.

  But how to pad the packet with dummy data.

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

I assume that you are using the FX2LP product. Please correct me if I am wrong.

In case you have configured the FX2LP to be in Auto-In/Auto-Out modes, it is the responsibility of the external device to pad the packet with dummy data, since the firmware has no control in data transfer.

In case you have configured the FX2LP with AUTOIN/AUTOOUT=0, the firmware can pad the packet with dummy data (or) the INPKTEND register can also be used to implement the hardware PKTEND functionality. To do so, keep track of the EPxBCH/BCL registers and write the INPKTEND register when the packet length is not a multiple of 512 byte.

Best regards,

Srinath S

View solution in original post

0 Likes
1 Reply
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

I assume that you are using the FX2LP product. Please correct me if I am wrong.

In case you have configured the FX2LP to be in Auto-In/Auto-Out modes, it is the responsibility of the external device to pad the packet with dummy data, since the firmware has no control in data transfer.

In case you have configured the FX2LP with AUTOIN/AUTOOUT=0, the firmware can pad the packet with dummy data (or) the INPKTEND register can also be used to implement the hardware PKTEND functionality. To do so, keep track of the EPxBCH/BCL registers and write the INPKTEND register when the packet length is not a multiple of 512 byte.

Best regards,

Srinath S

0 Likes