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

Radio test in 802.15.4 -mode

I'm running the SDK 17 radio test example on two nRF52840 DKs. My goal is to do a PER measurement in 802.15.4 -mode.

I configure the boards to use ieee802154_250Kbit mode, the same channel and same payload pattern for both boards.

I can get the reception to work for a little while. If I tell the sender to send 100 packets, I usually get 100 received packets. But for anything longer the reception seems to stop at some point.

For instance if I set the transmitter to send 10000 packets (start_tx_modulated_carrier 10000) and monitor the reception by issuing "print_rx"-commands on the receiver, the packet count initially increments but stops at some point. Usually at a few hundred packets. Now if I issue a new "start_rx"-command the packet count again starts to increment from zero (as expected), but again stops at some lowish value.

I also tried a lower packet rate by setting the transmitter to duty cycle modulation. If I do "start_duty_cycle_modulated_tx 10", ie 10% duty cycle, it is even easier to monitor the received packet count as it increments slower. But again the count stops incrementing fairly soon. And restarting the rx makes the reception work again for a while.

If I redo all of the above using ble_1Mbit -mode it all works. I can send 10000 packets and receive 10000 packets. So it seems to be related to the 802.15.4-mode.

All testing so far has been done at my desk, with the DKs a few centimeters apart.

Any ideas on how to make this work would be appreciated.

Parents
  • Ok, I think I may have a hardware revision issue. One of my DKs is actually a Preview DK. PCA10056 v0.9.2

    I used this PDK as the receiver in the tests I did earlier. Now I tried to reverse the roles, and this unit hangs when trying to start transmitting.

    Is this expected? I need to check the HW revisions but was there an issue like this on some earlier revision?

    I don't have a third DK at the moment to test.

  • Based on the date code I probably have an Engineering A version.... I didn't even remember I had a DK this early.

    And the Errata 110 would explain what I'm seeing:

    Consequences

    Might lose packets in BLE LR or 802.15.4 mode. Might lose some sensitivity in BLE and proprietary mode.

    Workaround

    Always disable the radio after having received a packet (using TASK_DISABLE).

    Ugh. I have ordered a few more DKs.

  • I've tried to compare the radio test examples from SDKs 15.3 and 17.0.2. A lot has changed, but I found something interesting among the changes.

    In SDK 15.3 the function radio_config writes directly to the radio registers.

    First it unconditionally writes this to the PCNF1 register:

    // Packet configuration:
    // Bit 25: 1 Whitening enabled
    // Bit 24: 1 Big endian,
    // 4-byte base address length (5-byte full address length),
    // 0-byte static length, max 255-byte payload .
    NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Enabled << RADIO_PCNF1_WHITEEN_Pos) |
    (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) |
    (4UL << RADIO_PCNF1_BALEN_Pos) |
    (0UL << RADIO_PCNF1_STATLEN_Pos) |
    ((sizeof(m_tx_packet) - 1) << RADIO_PCNF1_MAXLEN_Pos);

    A few lines later it checks if we wanted 802.15.4 -mode, and does this:

    NRF_RADIO->PCNF1 = (IEEE_MAX_PAYLOAD_LEN << RADIO_PCNF1_MAXLEN_Pos);

    So it overwrites the previously set PCNF1 configuration.

    SDK 17 does almost the same thing, but uses a configuration struct:

    /* Packet configuration:
    * payload length size = 8 bits,
    * 0-byte static length, max 255-byte payload,
    * 4-byte base address length (5-byte full address length),
    * Bit 24: 1 Big endian,
    * Bit 25: 1 Whitening enabled.
    */
    memset(&packet_conf, 0, sizeof(packet_conf));
    packet_conf.lflen = RADIO_LENGTH_LENGTH_FIELD;
    packet_conf.maxlen = (sizeof(m_tx_packet) - 1);
    packet_conf.statlen = 0;
    packet_conf.balen = 4;
    packet_conf.big_endian = true;
    packet_conf.whiteen = true;

    And again a few lines later, if 802.15.4 was requested:

    packet_conf.maxlen = IEEE_MAX_PAYLOAD_LEN;

    But done this way, the previous contents of packet_conf are not overwritten. And PCNF1 ends up different than in SDK 15.3.

    If I add code to reset the other PCNF1 fields (balen, big_endian, whiteen) to zero, I can receive 802.15.4 packets again.

    So this looks like a mistake made during refactoring. Although the original way was in my opinion a nasty surprise to leave for the future maintainer.

    Could someone at Nordic check if I'm on the right track here?

  • Hi Markku

    Thanks for the detailed report, I will try to reproduce the issue. 

    Have you tried to read out the content of the PCNF1 register from the two configurations to see how it differs?

    Best regards
    Torbjørn

  • Have you tried to read out the content of the PCNF1 register from the two configurations to see how it differs?

    I checked this now. PCNF1 is set as I expected.

    In SDK 15.3, when using 802.15.4-mode PCNF1 is 0x7F. So only MAXLEN is set.

    In SDK 15.3, using BLE 1Mbit-mode PCNF1 is 0x030400FF. So MAXLEN = FF, BALEN = 4, ENDIAN = 1 and WHITEEN = 1.

    In SDK 17.0.2, 802.15.4-mode gives 0x0304007F. So MAXLEN is correct, but BALEN, ENDIAN and WHITEEN are also set.

    BLE_1Mbit-mode in SDK 17.0.2 is identical to the earlier SDK.

  • Hi Markku

    I did some testing on my own, and it seems I am experiencing the same issue. In 802.15.4 mode I am not able to receive any packets. 

    I will have to look into this a bit more and get back to you. 

    Best regards
    Torbjørn

  • If you set the other PCNF1 fields (balen, endian, whiteen) to zero in 802.15.4-mode, the reception works again. That makes PCNF1 equal to the way it was in SDK 15.3. I'm not sure if everything is correct after that, or if there is something else needed also.

    I did also notice that the received packets counter occasionally ends up higher than the number of packets I sent. The rx counter increments every time a CRCOK event occurs. So I'm guessing that in 802.15.4-mode the receiver counts every valid packet, even those sent to other devices? I have not checked this further though.

Reply
  • If you set the other PCNF1 fields (balen, endian, whiteen) to zero in 802.15.4-mode, the reception works again. That makes PCNF1 equal to the way it was in SDK 15.3. I'm not sure if everything is correct after that, or if there is something else needed also.

    I did also notice that the received packets counter occasionally ends up higher than the number of packets I sent. The rx counter increments every time a CRCOK event occurs. So I'm guessing that in 802.15.4-mode the receiver counts every valid packet, even those sent to other devices? I have not checked this further though.

Children
  • Hi Markku

    Thanks a lot for the update. I made the same changes myself and verified that this made the example work. 

    I didn't notice the counter issues you experienced though, I get the right number of packets on the RX side depending on how many packets I send from the TX. How often do you see this occur?

    Did you ever see any packets come in if you don't enable the TX at all?

    Best regards
    Torbjørn

  • Did you ever see any packets come in if you don't enable the TX at all?

    I think I did. I'll need to recheck.

    We have things here in the office that use a proprietary 802.15.4-based protocol to communicate, so that seemed the most plausible explanation.

    Now that I think about it.. The address matching is done in software, right? I recall struggling with it when we first implemented support for our protocol for the nRF52840. The radio driver needed to do quite a bit of work filtering packets intended for other recipients.

    And since the radio test code is very simple, there is no software address matching. So this is probably the cause.

  • Hi 

    I don't have a lot of experience with 802.15.4-based protocols, but based on the product specification it seems you are correct. 

    Any packet matching the synchronization header field (consisting of 4 bytes of preamble and 1 byte SHR) will be accepted by the radio, assuming the CRC is OK. 

    Then the destination address will have to be decoded from the packet by the software. 

    Best regards
    Torbjørn

  • Reality is sinking in slowly... All this time I've had it on my mind that we're dealing with MAC level packets. With addresses and crcs and all that. But the radio test has none of that. I've looked at the code quite a while, even traced some of the register values, but it wasn't until I started adding some filtering that it dawned on me that we're dealing with bare PHY packets.

    So all we have is the synchronization header, a length byte (PHR), and a payload full of fixed values. No addresses, not even a crc. I guess it might be possible to add the crc calculation even if there is no actual MPDU, but I'm not sure.

    What I'm going to do is simply check that the payload matches the expected fixed pattern, that'll be good enough in my case.

  • Hi

    Correct, the radio_test example is very simple, and doesn't use any protocol per se. 

    For basic RF testing this is not really required. 

    Best regards
    Torbjørn

Related