Index > teleproject > USB nRF24L01 working | |
---|---|
Author/Date | USB nRF24L01 working |
memecode 20/07/2024 11:53am | Today, after at least 2 weeks of fighting with the hardware and software, I got the nRF24L01 chip attached to the ESP32 to talk to the nRF24L01 chip attached to the USB adapter. There were so many issues to get sorted out. And even now I'm not sure why it wasn't working earlier. I ended up with a mismash of code from all over the place.
I've put all the code I've written here for the moment. The ESP32 code to write bytes is in ./esp32/nrf_test and the reading side is a windows app in ./main.cpp. It's an LGI app with a cmake build as you'd expect form me haha. Some of the issues I had to deal with: 1) Getting the C++ code to talk to the CH340 based USB <-> nRF24L01 adapter: First I had no bytes out of the adapter, which turned out to be the wrong baud rate in the setup. Then I was getting garbage in the lines. That was the wrong charset. You have to convert from gb18030 to utf-8. Then I wasn't processing lines correctly. Then I added google translate for the Chinese strings. Then I added code to set the nRF24L01 receive parameters like channel, RX address and speed. 2) Getting the Arduino code to send bytes: My initial attempt involved the library of code that was linked by the nRF24L01 chip manufacturer. But that was flakey as. And never did work. Always with the "transmit error". Then I got a newer more complete library linked from some forum and it's minimal test program got to a point where I could see "TX success". But I had to play around with the configuration of the chip a little. But still no bytes appearing at the receiving end even with all the correct values on both sides. The final piece of the puzzle was copying the good RF24 library code into my original test code and recompiling there. And finally after 2 weeks of frustration, bytes started appearing on the receiver. |
Reply | |