Crc generation for sd card file

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

cross mob
AbPa_4654881
Level 3
Level 3
10 replies posted 10 questions asked 10 likes given

Hi all,

I am using psoc5lp with sd card. In sd card there is one *.txt file(~ 15 Mbytes). I want to generate CRC code for that  txt file. That I am able to do using basic crc C program but that is taking a very long time. Is there any way I can generate crc code using CRC componet present in the psoc5lp for sd card file.? Or any other way to speed up this process? Please suggest.

0 Likes
1 Solution

Considerable error checking and error handling features have been built into the USB to ensure data integrity and reliability. Note that for USBUART component, bulk transfer endpoints are used. So, error detection via CRC is done internally that guarantees integrity with gurantee of delivery.

So, the data received in the text file from the PC does not need any CRC detection again on the PSoC side

Regards,
Dheeraj

View solution in original post

8 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

AbPa,

You can allocate the CRC component and generate the CRC that way.  However, the CRC component is a serial CRC generation component which means the CRC computation is limited by the input clock feed into the component.

You said you are performing a SW CRC calculation but it is slow.  Is your SW implementation bit-wise or byte-wise?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Lepo, the SW implementation is based on byte-wise. And as crc component require a clock and datain input but my data is in sd card as .txt file. So I am not getting what clock I can give and how I can apply sd card data as input to crc component.

Thanks

0 Likes

AbPa,

Using the CRC component

Theoretically since the SD card is interfaced via a SPI comm, it should be possible to place a CRC component in parallel to the SPI comm component with MISO as the data input and the input clock can be the same as the input clock to the SPI component if the CRC component is in "Single Cycle" mode.

The trick with the above design is to only enable the CRC component on the Read phase of the SPI comm from the SD card.  This would require understanding of the SPI comm and would require creating the appropriate logic to time the enable.

The end effect is that the CRC would be computed in parallel to the data acquisition and the CRC result available a few clocks cycles after the last data is read from the SD card.

Using Byte-wise CRC

Byte-wise CRC SW computations are more efficient than the straightforward bit-wise CRC computations as you well know.  SW is limited by the efficiency of the coding implementation and the CPU clocking rate.  A 'quick' improvement is to up the CPU clock (BUS_CLK) to the maximum allowed.

Len

Len
"Engineering is an Art. The Art of Compromise."

LePo,

As of now, I am using EMFILE(SPI based only) for SD card communication but with emfile module, I don't think so I may be able to use the CRC component parallel to it. Similarly, I want to use the CRC component parallel to the USBUART module also but there is nothing as output pin/wire to EMFILE/USBUART module that I can connect to the CRC component. please correct me If I am wrong.

0 Likes

AbPa,

You are correct, unlike the UART component which has specific outputs to support a CRC component, the USBUART does not.

Are you looking to use the CRC with the USBUART for Tx or Rx?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

LePo,

I am sending one .txt file from pc to cypress using usbuart.so just want to make sure on cypress side using CRC that data received is correct.

0 Likes

Considerable error checking and error handling features have been built into the USB to ensure data integrity and reliability. Note that for USBUART component, bulk transfer endpoints are used. So, error detection via CRC is done internally that guarantees integrity with gurantee of delivery.

So, the data received in the text file from the PC does not need any CRC detection again on the PSoC side

Regards,
Dheeraj

AbPa,

Using emFile component with a CRC in parallel is going to be not possible with the component as it is currently specified.

The component does not provide the input clock, SPI CLK, DAT, MOSI, MISO as visible connections on the TopDesign.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes