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

USB superspeed peripherals Forum Discussions

Yamuna
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

Hi,

I have created the AUTO SIGNAL DMA channel between UIB and SIB and the buffer size is 8k and also I have created the DMA callback function.

And from host PC, using retVal = Endpt->XferData(data, len) API i'm pushing data. Here the length is not  constant, it varies from 256 to 7k.

To push data to SDIO device, the data length should be multiple of 256 bytes. So in Host PC itself we are making the data length as multiple of 256 bytes and then pushing data through  Endpt->XferData() API. After pushing each buff i'm getting DMA callback function. In callback function CyU3PDmaCBInput_t *input parameter gives us the info about the buffer and received data. Here input->buffer_p.count parameter gives us the valid data count in the DMA buffer. If the the transmitted data len is multiple of 1024 then the   input->buffer_p.count parameter says that the valid data len is 8k and for other data lengths i'm getting the correct value.

I'm trying to understand why such behaviour and how can I solve this issue?

Please help me solve the issue. 

Thanks & regards

Yamuna G 

 

0 Likes
1 Solution
AliAsgar
Moderator
Moderator
Moderator
750 replies posted 50 likes received 500 replies posted

Hi Yamuna G,

The DMA buffer on the UIB side gets committed to the consumer socket, in three conditions:

1. If DMA buffer is completely filled, 
2. If a Short length packet is sent from the host (<1024)
3. If a Zero-Length packet is sent from the host.

The observation you are seeing might be from the fact that, when a multiple of 1024 bytes of data are being sent to the device, the device waits for the complete DMA buffer to fill (8k in your case) and a PROD event occurs only when DMA buffer is committed.
For other length of data (not a multiple of 1024), the DMA buffer gets committed due to short length packet and hence the count of the buffer is equal to the data you are transferrring.

Hence, this is not an issue, but the characteristic of the USB.

If exact value of data that is sent from the host needs to be seen in the DMA buffer.count, set the DMA buffer size as 1024.

Best Regards,
AliAsgar

View solution in original post

1 Reply
AliAsgar
Moderator
Moderator
Moderator
750 replies posted 50 likes received 500 replies posted

Hi Yamuna G,

The DMA buffer on the UIB side gets committed to the consumer socket, in three conditions:

1. If DMA buffer is completely filled, 
2. If a Short length packet is sent from the host (<1024)
3. If a Zero-Length packet is sent from the host.

The observation you are seeing might be from the fact that, when a multiple of 1024 bytes of data are being sent to the device, the device waits for the complete DMA buffer to fill (8k in your case) and a PROD event occurs only when DMA buffer is committed.
For other length of data (not a multiple of 1024), the DMA buffer gets committed due to short length packet and hence the count of the buffer is equal to the data you are transferrring.

Hence, this is not an issue, but the characteristic of the USB.

If exact value of data that is sent from the host needs to be seen in the DMA buffer.count, set the DMA buffer size as 1024.

Best Regards,
AliAsgar