1 of 1 people found this helpful
You are not supposed to use CyU3PDebugPrint in DMACallback.
Please copy the input buffer to a global buffer and print in the main thread.
What is the amount of data that you are sending to SD card at a time and expecting to print in the dma callback?
>>What is the amount of data that you are sending to SD card at a time and expecting to print in the dma callback?
I'm sending a small text file containing numbers 1 to 8 from host to sd-card.
Even if i try to change data in the DMA callback function [CyFxMscApplnMultiDmaCb] as shown in the code below, the copy process from host to SD-card stuck forever, what is wrong in doing this step?
if (type == CY_U3P_DMA_CB_PROD_EVENT)
/* This is a produce event notification to the CPU. This notification is
* received upon reception of every buffer. The buffer will not be sent
* out unless it is explicitly committed. The call shall fail if there
* is a bus reset / usb disconnect or if there is any application error. */
for (index = 0; index < input->buffer_p.count; index++)
input->buffer_p.buffer[index] = ~(uint8_t)input->buffer_p.buffer[index];
status = CyU3PDmaMultiChannelCommitBuffer (chHandle, input->buffer_p.count, 0);
if (status != CY_U3P_SUCCESS)
CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\r\n", status);
As said in FX3SMSC_RAID1_Rev2 , there are additional overheads
(related to the file system that you use in your case) that sends to the sd card before writing the actual data.
Hence, you will receive producer event for every buffer of data transfer from UIB to SD card. It will have overhead + data.
Please let us know why you want to modifty the data being sent to SD card.
Because I want to XOR the data passing IN/OUT through the fx3s processor. It's a study project that I need to accomplish.
Any helpful feedback is appreciated
FX3S Raid 1 application is not recommended for modifiying the data in the firmware.
If you want to do any such modifications, please identify what is the overhead and what is actual data in the firmware and do XOR.
You may capture USB trace with Wireshark to idently flow of data from USB host to device. This will help you to identify what is the overhead and what is the actula data being sent.