esp32 + nRF24L01 reading garbage

Dear all,
I am working o a project where two remote units (Arduino ProMicro + nRF24L01 + sensors) send data to a central location (Arduino ProMicro + nRF24L01 + TFT display).
After a lot o work and help from this Forum I managed to get everything working.

Since I would like to add some more features to the receptor (more status leds, buzzer, alarm onn/off toggle button, etc) as well as a “faster display”, I decided to use an ESP32 in the receiver (using the VSPI pins for the display).

I tested the basic hardware with the Adafruit graphic test code and the display worked much faster than with the Arduino Promicro.

Then I connected the nRF24 sharing the ESP32 MOSI(pin23) and SCK(pin18) with the TFT display.
The other nRF24 pin were connected to the ESP32 as follows: MISO–> pin 19, CE–> pin4 and
CSN–> pin2.
(See attached wiring diagram)

I made the necessary changes in the (working) code to reflect the new wiring and the change of the board to ESP32.

To my surprize, the ESP32 can connect to both transmitters but it receives only garbage!!!
None of the values received (more than 10) is correct!
If I use the “old” Arduino receiver I can confirm that all the variables are being transmitted and received correctly.

Just in case I have also attached the receiver code, but be aware that it is a rather lengthy.

Any ideas?
Thank you

ESP32 wiring.pdf (338 KB)

Receptor_ILI9341_OptFlow_ESP32_Rev0.ino (17.2 KB)

rogerio414: To my surprize, the ESP32 can connect to both transmitters but it receives only garbage!!!

Why should the connection be a surprise? :)

Have you tried the ESP32 with the shortest possible program that just works with the nRF24 and nothing else attached? That MUST be the starting point for debugging.

If it does work then you know that something else is causing the problem. And if it does not work you will be able to show us a short program that illustrates the problem.

Please don't post diagrams as PDF files as we can't see them without downloading them. Post them as a JPG or PNG file and make the image visible in your Post. See this Simple Image Posting Guide

...R

I did not followed your reasoning.
I had a WORKING system and just replaced the microprocessor board.
Once corrected for pin assignments, a working code should be a working code
Would you please explain?
thanks

PS Image added to the original post as suggested.
Thank you.

rogerio414: I did not followed your reasoning. I had a WORKING system and just replaced the microprocessor board. Once corrected for pin assignments, a working code should be a working code Would you please explain? thanks

PS Image added to the original post as suggested. Thank you.

It's sometimes called, "divide and conquer" methodology. Basically you are not sure what mistake you made in the wiring or code. By testing for example, the display only and the NRF perhaps one will work and not the other. Then you have eliminated 50% of the unknown problem from the entire problem, and you know where to focus your efforts.

rogerio414: I did not followed your reasoning. I had a WORKING system and just replaced the microprocessor board.

In this particular case that is an ENORMOUS change - almost everything about an ESP32 is different from a ProMicro. It's like changing from an F1 car to a World Rally Championship car.

My reasoning is simplify, SIMPLIFY SIMPLIFY

...R

Thank you all for the replies. Yes, you are correct. I have tested the display wiring already as stated in the first post and it works. I could remove the display and check if the RF24 is receiving the data without corruption via the serial monitor (I will do that). But my major concern is about the wiring/configuraion of two SPI devices sharing the same "port"(?). I read one expressif doc what are the pins related to the "VSPI port", and the the "first device" CS pin would be GPIO5. Also, it seems up to 3 devices can be connected to it, but I could not find any reference to the other pins that could be used as CS. There are some posts elsewhere on the internet of people having problems to connect more than one device to the VSPI port. Any comment on this? Thank you.

Yes, I have a comment. Before attempting the combining of SPI lines, you should test the NRF all by itself, as you suggest.

Thank you all!! You were right from the start.

The RF24 alone is not reading the data as it should.

I would never think that would be possible!!!

I have even tried to connect the CE and CSN pin according to another post were it worked.

Is this a driver problem?

How can I debug an error like this?

Thank you again, Roger

rogerio414: How can I debug an error like this?

Start by posting the short program that you are using to test the nRF24 with the ESP32

Also post the program from the other Arduino that is sending the message.

And provide an example of the actual message that is sent and of what is received.

...R

Thank you for the reply. I started using the program that was working with the ardunos, hoping thst it would work. Now that I know that there is a problem with combination (ESP32 + RF24), I will have to start with the Hallo World, as you have suggested earlier. I will do that and post the results as soon as I have them. Regards, Roger

If you use the examples in this Simple nRF24L01+ Tutorial it will be muh easier to help if you have a problem.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

...R

Sorry it took so long to post but I've been without time to work on this project. I ran the simple code proposed by Robin2. The results were: 1 - The ESP32 could receive the messages, but sometimes it receives more than one time 2 - It is taking TOO LONG to receive each packet, from 30sec to 1min each. 3 - The time interval between the packets vary at random.

I have read that it has been an issue with ESP32 and should have been corrected in the latest revision of TMRh20 library.

My working bench has a dual band router so, just in case i turned it off. It has not interfered with all the development work I have made for this project so far (which utilizes 2 transmitters and one receiver)

Turning the router OFF had no significant impact on the time between aech reading, but there were no duplicate lines after that.

Any ideas?

The messages read on the serial monitor are copied below: Data received Message 0 Data received Message 1 Data received Message 2 Data received Message 3 Data received Message 4 Data received Message 4 Data received Message 5 Data received Message 5 Data received Message 6 Data received Message 7 Data received Message 7 Data received Message 7 Data received Message 8 Data received Message 9 Data received Message 0 Data received Message 0 *Router turned off****** Data received Message 1 Data received Message 2 Data received Message 3 Data received Message 4 Data received Message 5 Data received Message 6 Data received Message 7 Data received Message 8 Data received Message 9 Data received Message 0 Data received Message 1 Data received Message 2

rogerio414: I ran the simple code proposed by Robin2. The results were: 1 - The ESP32 could receive the messages, but sometimes it receives more than one time 2 - It is taking TOO LONG to receive each packet, from 30sec to 1min each. 3 - The time interval between the packets vary at random.

I assume you have a regular Arduino (what board?) sending the data to the ESP32 ?

AND I assume you are using my programs without any changes ?

Can you program another regular Arduino as the receiver and see if it works properly in place of the ESP32 (with the ESP32 turned off, of course). If it does then the problem must lie with the ESP32 - perhaps its WiFi is interfering?

Have you tried operating the nRF24 on different channels?

...R