CRC on the nrf52840

Hello!

Regarding the CRC on the nrf52840 the specifications make it clear that the maximum length of the CRC is 3 bytes, We are working on an industrial communication protocol that we want to implement on the nrf52840. This protocol needs 4 bytes crc (crc32), is there a workaround for this? 

Thanks! 

Parents
  • Hello,

    The 3 byte CRC is first and foremost the standard of Bluetooth Low Energy, and not specific for the nRF52840.

    For a 4 byte CRC, check out the function crc32_compute() found in nRF5 SDK 17.1.0\components\libraries\crc32\crc32.c

    If you are using a different nRF5 SDK version, you will probably find something similar. If you are using NCS (and not the nRF5 SDK), there is probably something similar to that as well. In that case, please let me know if you can't find it.

    Best regards,

    Edvin

  • So to clarify what you are suggesting, the nrf52840 is capable of a 4-byte crc? Do you just need to configure it in such a way?

    Am I understanding you correctly?

  • Okay fair enough, What we are trying to figure out is whether the nrf52840 will be able to support an industrial communication protocol called IO-Link Wireless. This protocol builds upon Bluetooth Low Energy version 4.2, but it requires 4 bytes CRC instead of 3. With that information, do you conclude that the nrf52840 board will not be able to support IO-Link Wireless since it has this specification? 

  • That depends on how the IO-Link Wireless does this. To be fair, I don't think that everyone using this protocol has written their own Bluetooth stacks (but they could of course be using some sort of open source stack. I don't know). If they use 4 bytes instead of 3, they will also be breaking the specification, so they will not be able to certify it with Bluetooth SIG. 

    Are you sure that the 4 byte CRC is not just added to the Bluetooth payload packet (and then the standard 3 byte CRC follows after that)? I am not familiar with IO link (in fact I never heard of it before now), and a quick google search didn't really make me a lot smarter on that topic. Either way, if your question is whether it is possible to increase the CRC from 3 to 4 bytes inside our Bluetooth stack, then I am afraid the answer is no.

    But if that is the case, I doubt that there exists another wireless protocol that is an exact copy of the Bluetooth Low Energy standard, with the only difference being one extra byte of CRC, so in that case, I guess it wouldn't work anyway.

    It may be that I don't understand this fully, but perhaps you can ask the developers/owners of IO-Link whether that is actually the case (that they are equivalent to BLE apart from the amount of CRC bytes)

    Best regards,

    Edvin

  • Okay I think there is some confusion but I will try to clarify a bit.

    So, IO-Link Wireless, uses a 4 byte CRC for each packet, it sends packets back and forth between slave and master and they both use a 4 byte CRC on each packet, when looking at the radio peripherals in the specification each received packet and transmitted packet uses the hardware module CRC which only support 3 bytes, consider this package down below, this is what is called a "configuration downlink" in the IO-Link Wireless specification, it is a communication exchange from a master to a slave, it is used for configuration purposes.

    Now the big question, can you configure the radio it in such a way that it can still support 4 bytes CRC via software? So hypothetically you implement an IO-Link Wireless stack on the nrf52840 board and use a 4 byte CRC but it works via software and NOT via the hardware module, or maybe, the software CRC can complement the hardware CRC? so that is becomes 4 byte CRC.  Do you think that that is possible? and if so, how can you do that?

    Best regards

  • Hello,

    I see. So just to clarify, you can not use the Bluetooth stack (Softdevice) for this. But if you were to implement your own radio protocol, you can implement a 4 byte CRC and attach it to the end of your payload. If you do this, please remember to disable the radio's built in CRC, by setting the NRF_RADIO->CRCCNF register to 0x00000000, which will exclude the HW CRC from the packet. 

    kongstrupp said:
    or maybe, the software CRC can complement the hardware CRC?

    That is more complicated. I wouldn't recommend that.

    Best regards,

    Edvin

  • Hello Edvin, Can we have a live meeting with you on Zoom? That would mean a great deal for us if you could, This is pretty hard to discuss in a forum like this

    Thanks a lot

    Best regards!

Reply Children
  • Actually, I don't think it is as effective as you may assume. I too need to look up things to be able to answer questions. Was there something in particular you wanted to ask?

    BR,

    Edvin

  • Well we really need to know how this shortcut of 4 bytes CRC would do in terms of timing and how effective it would be, since you said that it would be possible to add this extra CRC on received packets in the radio on the nrf52840. 

  • I was thinking about writing something about timing in my reply yesterday, but I skipped it Slight smile 

    I don't know anything about this protocol that you want to use, other than that it has a 4 byte CRC. But what I know from BLE is that in this case, a SW based CRC would probably not work, since the timing requirements are very strict, and the peripheral/server/slave needs to modify the reply packet based on the incoming packet, and then generate a CRC in a very short time. So whether it will work or not probably depends on timing. I guess you just need to test and see.

    Best regards,

    Edvin

  • I see, I will try to summarize the timing scheme within the IO-Link Wireless protocol as much as I can. 

    Down below a picture of a sub-cycle between master and slave is shown. This is a scheme that show a complete communication exchange between master and slave. 

    As you can see the yellow part is the downlink (master to slave), and the green parts are the uplinks (slave to master). So a downlink is sent from the master and received by all slaves, and then, the uplinks are returned in a special order to the master.

    At the end of each uplink and downlink the IO-Link Wireless protocol requires a 4 byte CRC. Note that between each green slot, there is a red interval to avoid collision on air (guard interval). This guard interval is 8 us, which means that the master (considering this software solution) needs to be able to calculate a 4 byte CRC within LESS than 8 us

    So, we are very interested in knowing if the CPU is able to do this. Can it calculate a 4 byte CRC this fast? Is there a way to measure the processors execution time? I looked online and it seems to be a bit more complicated that I thought. Please let me know if this information that I have just provided is not sufficient for you to be able to determine weather or not this is possible.

    Thanks a lot Edvin for you inputs really means a grate deal for us 

    BR

     

  • Is there a CRC after each of the green sections (before the red sections)? Or is it a CRC after the entire thing in the picture? And is the CRC dependent on the downlink, or can you generate it before the downlink?

    kongstrupp said:
    This guard interval is 8 us, which means that the master (considering this software solution) needs to be able to calculate a 4 byte CRC within LESS than 8 us

    I did not forget to answer this, but I don't know how long it takes. You would need to test this. I guess it depends on what else the nRF is doing at the time, and even if it is doing this as the highest priority I don't know how long this function call will take. It probably depends on the length of what you need to generate the CRC of. Before you ask, I don't know how large a packet you could generate a 4byte CRC below 8µs is either. You need to test.

Related