micropython / micropython/micropython-lib

NRF24L01 problem with failing send command

Open
#610 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

I'm trying to communicate between an RPi4 running python and the py-nrf24 lib and a Pi Pico using the micropython NRF24L01 driver.
I can transmit data and started building my application but am encountering intermittent data transfer problems. I started out with the given examples on both sides and cut them down step by step to fit my needs.
It all boils down to the following line which I first ignored:
https://github.com/micropython/micropython-lib/blob/a5ef231e7d854bab0e6db95f1676173e2281ee3b/micropython/drivers/radio/nrf24l01/nrf24l01test.py#L63 Putting a print there tells me that the send command before always succeeds ones and then fails on the next call.
I then tried some variations of waiting (maybe it just needs time to send and acknowledge?) but ended up simply using https://github.com/micropython/micropython-lib/blob/a5ef231e7d854bab0e6db95f1676173e2281ee3b/micropython/drivers/radio/nrf24l01/nrf24l01.py#L227 This works most of the time even without waiting for any acknowledgement.
Calling https://github.com/micropython/micropython-lib/blob/a5ef231e7d854bab0e6db95f1676173e2281ee3b/micropython/drivers/radio/nrf24l01/nrf24l01.py#L245 immediately after send_start() like send() does definitely seems fishy on the Pico, some timing issue or similar.
I'm just sending around a dozen bytes in 100ms intervals for testing. I now ran into, as it seems, some kind of buffer overflow as the pico stops sending after some amount of time.
Currently I'm using these settings on the Pi Pico (and RPi 4 equivalent):

  • payload size = 32
  • POWER_3
  • SPEED_250K
  • SPI 0
  • breadboard
  • USB power from PC
  • devices separated by one building story (although the send successful -> send fail -> success -> fail loop happened with both radios next to each other as well)

I didn't yet fully understand the pipes/addresses concept. Both Pis use the same address, the Pico sends, the RPi4 receives. As there seem to be up to 6 receiving pipes/addresses and the RPi lib by default puts my configured address in slot 1 (0 based index) maybe the acknowledgment functionality is the culprit.
If both NRF use the same address for communication, on which pipe/address do they exchange the acknowledgement?
How do you even configure it in the micropython lib?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with micropython/drivers/radio/nrf24l01/nrf24l01.py at send(), send_start(), and the referenced nrf24l01test.py line. Reproduce the alternating send success/failure and later stoppage using the stated Pico and NRF24L01 settings, then trace acknowledgements, pipe addresses, timing, and buffer state. Done means the failure is explained and the relevant driver behavior or documentation is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.