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

The nRF52832 received an error packet with crcok and length wrong.

Hi all,

   When I do some tests on chip of nrf52832,the chip sometimes receive an error packet: the crc status is ok,but the length field is random.The reference  documents shows:If the payload plus add-on length is specified larger than MAXLEN, the RADIO will still transmit or receive in the same way as before except the payload is now truncated to MAXLEN. The packet's LENGTH field will not be altered when the payload is truncated. The RADIO will calculate CRC as if the packet length is equal to MAXLEN.That means if a large  random data is received,it wii be trunctaed and calculate CRC as if the packet length is equal to MAXLEN.Obviously,in that case  the CRC is rarely ok.

 Does the radio calculate crc accoding to the LENGTH field when it receives a normal packet?Does  the LENGTH field  decide the number of bytes payload received ?

Parents
  • Hi

    Assuming the value in the LENGTH field is less than or equal to MAXLEN the length of the incoming payload and the CRC calculation should be based on the value of the LENGTH field, yes. 

    What is the size of your CRC field and your address?

    Unless these are short it should be extremely rare to have a packet with errors that pass the CRC test. 

    Best regards
    Torbjørn

  • Hi,

       Thanks a lot!From the datasheet:after the whole packet including the CRC has been received, the RADIO will generate a CRCOK event or CRCERROR event.1.Does the radio calculate the CRC while receiving one byte by another or untill all the bytes are recieved ?

    2.Does the radio receive bytes of payload according to the  LENGTH field?

    3.The s0, length,s1 and payload is moved to the somewhere in data ram according to the PACKETPTR,however the preamble, address,and crc is kept to where? How does the radio distinguish these fields?For example, how does teh radio distinguish adress from the rest of the fields?Because only  s0,length,s1,payload and crc can be accessed.

    4.CRC, Address match, Packet disassembler and other process are dealed after the whole packet is fully received?What does the address event indicate?Just the bytes of address bytes are received?And where are these bytes kept?I once thought the address event indicated the address match or not but the fact was obviously not that.

    5.Does easy dma move every  byte to somewhere in data ram while receiving?If so, is the time of tx_end  the same as the rx_end except  the subsequent CRC, Address match and so? 

  • Hi

    1. I don't know at what exact time the CRC is calculated, but it is ready when the CRCOK or CRCERROR and END events occur.

    2. The length of the payload is the number of bytes specified in the LENGTH field, plus the number of bytes defined by the STATLEN field in the PCNF1 register. 

    If STATLEN is set to 0 then the payload is only defined by the value of LENGTH. 

    3. The preamble is hard coded and is not stored anywhere. The addresses are stored in the BASE0, BASE1, PREFIX0 and PREFIX1 registers. The CRC is stored internally, and made available through the RXCRC register. 

    The radio distinguishes the different fields by their order in the payload. On the TX side they will all be sent in sequence as defined by the payload. 

    On the RX side the radio will look for an address match from the incoming data stream, and start receiving the other fields (S0, LENGTH, S1, payload and CRC) after an address match occurs. 

    4. Address match occurs immediately after the reception of a valid address, and acts as a sign to the rest of the system that a valid packet is about to be received. After an address match happens you can read the RXMATCH register to figure out which of the 8 logical addresses triggered the address match. 

    The remaining bytes in the payload and CRC are received after the address match happens, and will trigger the PAYLOAD and END events later on. 

    5. Yes, the radio will transfer incoming data to RAM as the packet is being received. 
    What do you mean by tx_end and rx_end, can you point me to the document or code where these are being referenced?

    Best regards
    Torbjørn

  • Hi,

       Thanks a lot!

    1. That means: END and CRCOK or CRCERROR event almost occur at the same time?

    2.I need to confirm that: if the STATLEN is 0, the radio receive bytes of payload is according to the LENGTH field.It only truncate the payload when payload length is specified larger than MAXLEN.In this case,the payload is possibly wrong and the value of LENGTH field is might shorter or longer than  the exact value from the origin tx side.How does the radio decide to receive the following payload?Still depend on the LENGTH field?

    3.The radio distinguishes the different fields by their order in the payload.-->when reciving,the radio will consider the first bytes as address, the following bytes as S0,LENGTH,S1 and so on?

    On tx side,the addresses are stored in the BASE0, BASE1, PREFIX0 and PREFIX1 registers.But where those are stored when receiving?

    On the RX side the radio will look for an address match from the incoming data stream.That means:the rx side begins to receive the S0,LENGTH,S1,payload,CRC only when address match or stops receive when address does't macth?

    4. Address match occurs immediately after the reception of a valid address.-->Only when address match,the radio will trigger an address event ?Or will trigger all the times just after receiving an address no matter it matces or not? 

    The RXMATCH is logical address of which previous packet was received.When the received address is beyond the logical address(perhaps a wrong address),how does the radio deal with it?Just discard it ?What is the value in the RXMATCH register?

    5.The question as follows:

    When the tx side send all the bytes and an end even occurs,does the rx side happens to receive all the bytes or an end event occur?

    Does the tx always begin to send packets when tx start task s triggered?In what occasons the radio will not begin to send?For example,the air environment  is not good.

  • Hi

    1. Good question, the documentation seems a bit unclear on this point. I assume it happens at the same time as the END event, but I will double check with the designers and get back to you. 

    2. Do you mean what happens if there is a bit error in the LENGTH field that makes the length larger than intended?

    If this happens the radio would receive a number of bytes equal to MAXLEN, check the CRC, and see that the CRC check fails because of the bit error in the LENGTH field. 

    3. "The radio distinguishes the different fields by their order in the payload.-->when reciving,the radio will consider the first bytes as address, the following bytes as S0,LENGTH,S1 and so on?"

    Yes. Once the receiver gets a valid address match it will assume that the address has been received, and start receiving S0, LENGTH, S1, payload and so on, and store the data in the assigned RAM buffer. 

    "On tx side,the addresses are stored in the BASE0, BASE1, PREFIX0 and PREFIX1 registers.But where those are stored when receiving?"

    The receiver has the same registers as the transmitter. If the packet sent from the transmitter has an address that matches one of the addresses configured in the receiver it will trigger an address match event, and the rest of the packet will be received. If you haven't configured the address registers correctly in the receiver then the packet will not be received. 

    "That means:the rx side begins to receive the S0,LENGTH,S1,payload,CRC only when address match"

    Yes

    "or stops receive when address does't macth?"

    It doesn't stop reception when the address doesn't match, it keeps listening for a valid address. 

    4. "Address match occurs immediately after the reception of a valid address.-->Only when address match,the radio will trigger an address event ?Or will trigger all the times just after receiving an address no matter it matces or not? "

    It is important to understand that the radio doesn't know when it is receiving an address, or when it is just receiving random noise from the air. Any bit coming into the radio could be the start of a valid address, and the radio simply has to check every single bit and match it to the preceding 16-40 bits to see if they match the address that you have configured. 

    With a bitrate of 1Mbps this happens one million times every second, which means every second the address matcher have to "discard" one million potential addresses until a valid address is found. 

    You can imagine the address matcher as a shift register that all the incoming data is passed through, and as soon as the entirety of a valid address is shifted into the register it will trigger a match. 

    "When the received address is beyond the logical address(perhaps a wrong address),how does the radio deal with it?Just discard it ?What is the value in the RXMATCH register?"

    It ignores it, and doesn't change any registers. As I described above this will happen a million times a second when the bitrate is 1Mbps, so it is a very common occurrence Slight smile

    5. "When the tx side send all the bytes and an end even occurs,does the rx side happens to receive all the bytes or an end event occur?"

    I am not sure I understand the question. If the packet is successfully received by the RX then the ADDRESS, PAYLOAD and END events on the receiver will happen shortly after the ADDRESS, PAYLOAD and END events on the transmitter. There will be a small delay caused by the travel time of the radio packet and the delay in the receiver chain, but this is just a couple of microseconds. 

    "Does the tx always begin to send packets when tx start task s triggered?In what occasons the radio will not begin to send?For example,the air environment  is not good."

    Unless the transmitter is in the wrong state (like if it is already in the middle of transmitting a packet) then it will start every time. The transmitter doesn't care about the RF environment, since it has no way to know what is happening on the air when it is in transmit mode. 

    The radio is half duplex, and can not receive and transmit at the same time. 

    Best regards
    Torbjørn

  • Hi 

    Regarding 1. CRCOK/CRCERROR will actually happen one 16MHz clock cycle before the END event, not after as I predicted. 

    Best regards
    Torbjørn

  • Thank ou very much!I'm using nrf52832 in our future products and a private protocol instead of bluetooth.So I need more details about the chip to get a better firmware.Thank you again for your kind and exhaustive descriptions.

Reply Children
No Data
Related