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 tried 11 and 26. The radio test even prints a message if you try to use an invalid channel, so I don't think this was an issue.

  • I feel like I must have a simple mistake somewhere, as this is just not working at all. So here is again what I'm doing:

    Two nRF52840DKs, both new, both version 2.0.1

    I program both with the radio test example from SDK 17.0.2. I use Keil for compiling and programming in case that matters.

    Open two terminals to send commands. I used putty.

    Issue the following commands for both DKs:

    • data_rate ieee802154_250Kbit
    • transmit_pattern pattern_11001100
    • start_channel 16
    • end_channel 16

    All commands were successful, and the DKs responded accordingly.

    Now on one DK start reception: (start_rx)

    And on the other start transmitting 500 packets: (start_tx_modulated_carrier 500)

    Once the transmitter prints that it is finished, print the receive status on the receiver: (print_rx)

    The result I'm seeing is that nothing was received.

    Now I change the mode to BLE (data_rate ble_1Mbit) on both units. Restart rx, resend the 500 packets.

    Printing results shows that all 500 packets were received.

  • Some further things I tried:

    Tried the other payload pattern (11110000)

    Explicitly set the tx power, even though the default was fine for my tests

    Verified that the code catches the mistake if I try to set a channel not between 11-26

    To rule out the Keil tools I flashed the precompiled radio_test_pca10056.hex to the DKs using nRF Connect Programmer

    None of this changed a thing.

  • Ok, if I take the radio test code from SDK 15.3 I can receive using the same procedure.

    The 15.3 radio test doesn't have a rx packet counter, but by varying the tx payload an printing the received payload I can see that it does receive the correct packet at least once.

  • 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?

Reply
  • 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?

Children
  • 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.

  • 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

Related