8 Replies Latest reply on Aug 23, 2020 9:53 PM by DheerajK_81

    Crc generation for sd card file

    AbPa_4654881

      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.

        • 1. Re: Crc generation for sd card file
          LePo_1062026

          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

          • 2. Re: Crc generation for sd card file
            AbPa_4654881

            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

            • 3. Re: Crc generation for sd card file
              LePo_1062026

              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

              1 of 1 people found this helpful
              • 4. Re: Crc generation for sd card file
                AbPa_4654881

                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.

                • 5. Re: Crc generation for sd card file
                  LePo_1062026

                  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

                  • 6. Re: Crc generation for sd card file
                    LePo_1062026

                    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

                    • 7. Re: Crc generation for sd card file
                      AbPa_4654881

                      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.

                      • 8. Re: Crc generation for sd card file
                        DheerajK_81

                        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

                        1 of 1 people found this helpful