This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Radio 2.4GHz LENGTH Field

After reading the document for nRF52840 Radio Peripheral. I have a doubt about LENGTH field in packet format. what is the difference between LENGTH field and STATIC_PACKET_LENGTH and when to use?  How to use 4bit LFLEN  for sending packets? where and when to use S0, S1 fields? Please clarify my doubts. 

  • Hi

    STATIC_PACKET_LENGTH is mainly used for protocols that don't support dynamic packet length (meaning the size of the LENGTH field is 0). Essentially the total packet length is the value of LENGTH + STATIC_PACKET_LENGTH, so if you know that all your packets will have a minimum size > 0 you can configure this in the STATIC_PACKET_LENGTH, and only use the LENGTH field to add additional payload bytes. 

    Is there any particular reason you want to access the radio registers directly?

    Unless you have very particular requirements I would suggest using one of our existing RF protocol implementations, such as BLE or ESB. Then you don't have to spend a lot of time on the low level radio protocol implementation. 

    Best regards
    Torbjørn

  • Thanks for your fast reply. Can i use only LENGTH field for packet transfer by using register directly? If it so then how many bits i can use with LENGTH field.

  • Hi

    You can set STATIC_PACKET_LENGTH to 0 and only use the LENGTH field, that is correct. 

    The LENGTH field can be between 0 and 8 bits in size, as configured through the LFLEN field. 

    Obviously the maximum length of the packet is lower if you have a shorter LENGTH field. 

    Back to your question about S0 and S1 these are optional header bits/bytes that will be added before and after the LENGTH field. As an example the BLE stack will use these fields to form the standard BLE packet header. 

    Best regards
    Torbjørn

Related