This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

debug C8051F411 with crc-functions don't work

Hi there,

i use a SiLabs C8051F411 with an onboard crc32-engine.
In my firmware i build a crc32-checksum of the downloaded hex-file in flash. This checksum is compared to a pre-saved crc32-checksum (written to an other page in the flash-memory).
This works fine.

Now i try to simulate this behavior with µVision V4.22.0.0, but i don't work.
I use an initialization-file to write my precalculated checksum in the memory before debugging,
eg: E CHAR c:0x7A00 = 0x07,0x08,0x03,0xE8

In the code-window of the debugger i see the downloaded hex-file and the precalculated checksum, it all looks correct.

But i get different checksums from the simulation to the real hardware.

Second, i can't access the crc32-result in the debug-session, i only can access bits 7..0 of the 32 bit result.

The datasheet of the C8051F411 says:

14.5.Accessing the CRC0 Result
The internal CRC0 result is 32-bits (CRC0SEL = 0b) or 16-bits (CRC0SEL = 1b). The CRC0PNT bits select the byte that is targeted by read and write operations on CRC0DAT and increment after each read or write. The calculation result will remain in the internal CRC0 result register until it is set, overwritten, or additional data is written to CRC0IN.

The pointer CRC0PNT isn't incremented by the debugger after a read-access to CRC0DAT.

Any ideas? Do i have to make any additional settings?

best regards,
michael

  • On this topic of SiLabs forum (http://www.cygnal.org), we discussed on the CRC unit on 'F41x
    www.cygnal.org/.../000955.html

    Even on CRC-32 of the same CRC polynomial, there are implementation-dependent variations.
    - Initial value: 0x00000000 or 0xFFFFFFFF
    - Invert the result or not
    - Bit reverse: input and/or output - apply bit flip function of the 'F41x CRC unit.

    To find out how uVision implement it, this on-line CRC calculator may help you.

    CRC calculator
    zorc.breitbandkatze.de/crc.html

    And then, you'll be able to reproduce it on the CRC unit.

    Tsuneo

  • The variants of CRC with our withut initial/final invert, and with most significant bit first or last, are covered in most documentation about CRC. So any project making use of CRC (hw or sw) need to decide which options to use.

  • Hi Tsuneo, Hi Per,

    you are both right. I did all this settings in my software:

    void CRC32_engine_Init(void)
    {
      CRC0CN    = 0x04;     // select 32bit CRC, init-value = 0xFFFFFFFF
                            // poly=0x04C11DB7
      CRC0CN   |= 0x08;     // init CRC-result
    }
    


    I use no final invert. This are all settings i have to do in the uC (there are no more settings available).

    As told before, the hardwaresolution works fine. I'm not able (not allowed) to adapt the sourcecode for simulation with uVision. I have to use the original code written to flash...

    I also used the crc32-algorithm shown in the datasheet (chapter 14.2,C8051F41x Rev1.1 11/08) and did the crc in an simple program by myself. The results matched the results generated by the uC.

    So, if the uVision crc-algoritm differs from the algorithm implemented in the uC, there is no way to get the correct results in the debugger?

    Does it make sens to implement a different crc-algorithm in uVision for this uC? If so, i always have to use different firmware for the identical results? One for debugging, one for real life??

    best regards,
    Michael

  • It is normal that there are zero invert or invert both pre and post (i.e. 0xffffffff as start value and an invert of the final value computed).

    Starting with 0xffffffff but not doing any final invert is quite uncommon.

    Most CRC-32 are using a specific polynomial. But that polynomial are represented in two ways, depending on serial communication that sends most significant bit first or least significant bit first.

  • > Now i try to simulate this behavior with µVision V4.22.0.0, but i don't work.

    Do you mean you ran the CRC unit on simulator?
    The CRC unit isn't supported by uVision simulator.
    "Simulated Features" doesn't list up this unit.
    http://www.keil.com/dd/chip/4114.htm

    Tsuneo

  • that's the reason. i didn't check this page, sorry....

    best regards