nrf24l01
-
Hello everyone, I use Wipy 2.0 in an esp32 wroom32 and I can not use a micropython library for nrf24l01. can anybody help me?
-
@pedrofelipest said in nrf24l01:
Please verify a) the intended connection as belowCE on P6 -> GPIO27
CSN on P21 ->GPIO26
SCK on P22 ->GPIO25
MISO on P12 -> GPIO21
MOSI on P20 -> GPIO33b) The semantics of the SPI method may be different between the poerts. Please compare the different ports (Pycom and micropython) by printing the results and self.buf content from write_register and read_register.
-
You have returned this error. And u checked nrf and it's working. I tested it in standard Arduino code.
File "<stdin>", line 1, in <module> File "boot.py", line 34, in master File "nrf24l01.py", line 77, in __init__ OSError: nRF24L01+ Hardware not responding
CE on P6
CSN on P21
SCK on P22
MISO on P12
MOSI on P20
-
@pedrofelipest said in nrf24l01:
self.spi.readinto(self.buf, 0x20 | reg)
According to the documentation, the syntax is:
self.spi.readinto(self.buf, write=(0x20 | reg))
or later
self.spi.readinto(self.buf, write=value)
If that works, you have to change the other places too.
-
I set the pins to use the SPI
csn = Pin(cfg['csn'], mode=Pin.OUT, value=1) ce = Pin(cfg['ce'], mode=Pin.OUT, value=0) spi = SPI(0, pins=('P22','P20','P12')) nrf = NRF24L01(spi, csn, ce, payload_size=8)
Make a mistake in the library
def reg_write(self, reg, value): self.cs(0) self.spi.readinto(self.buf, 0x20 | reg) # The mistake happens here. More arguments than necessary ret = self.buf[0] self.spi.readinto(self.buf, value) self.cs(1) return ret
-
@pedrofelipest Yes, and my other question:
- how do you call that module? Which parameters do you use?
- What is the result of the call. Any error messages?
-
It is https://github.com/micropython/micropython/blob/master/drivers/nrf24l01/nrf24l01test.py @robert-hh
-
@pedrofelipest Please give a link to that library, post the section of code in which you use the library and what kind of response you get.