Skip to main content
Kuikui
Associate III
November 8, 2013
Question

USB reports and CRC

  • November 8, 2013
  • 2 replies
  • 871 views
Posted on November 08, 2013 at 17:12

Hello everyone,

I have a product based on an STM32 and a SPI flash NOR memory.

I store some data inside the flash NOR, then I read them back through USB.

Sometimes (very rare, but happens ..), I get a few corrupted bytes when I read them through USB.

The question is :

Is it possible that the data can be altered during USB transfer ?

I don't include a CRC or chekcsum within the data of my HID reports, should I ?

Or does the USB stack over my hid reports includes a CRC and an automatic ''retry'' if the checksum fails, meaning that the Windows function that reads the USB report is sure to get non-altered data ?

If USB HID reports are ''error-free'', I guess I should secure my write and read operations on the NOR memory.

Thanks for your help.

Best regards,

Vincent.
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    November 8, 2013
    Posted on November 08, 2013 at 19:06

    I'd CRC the data read from the SPI Flash, and then send it over the USB, hopefully this would prove the error is not in the USB-to-PC transfer.

    I'd also do repetitive read and CRC of blocks within the SPI Flash, do random block reads and confirm you always get the same CRC, and do a burn in test of that.

    Then do the same test reading random block via USB, on the same memory, and test the system end-to-end.

    This way should be able to confine the problem.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Kuikui
    KuikuiAuthor
    Associate III
    November 12, 2013
    Posted on November 12, 2013 at 09:52

    Thank you clive1 for your answer.

    Indeed, there are several ways to find who generates the error, but since it appears on only a few bytes over hundred megabytes or so, if ever someone knows wether USB to PC transfer is error-safe or not, it would prevent me from wasting time about testing it.

    It's not about laziness, but even reading the USB spec would take less time than running a test ... so maybe a USB ''guru'' here ? :)