NRF24l01 and TFT Shield on Mega

Hi there,

i have a Problem getting a NRF24l01 to work together with a TFT Shield.
I've soldered wires to Pins 50,51,52 (MISO, MOSI, SCK) and Pin 9 + 10 for CE and CSN on nrf24l01.

When I run Radio.printdetails() there is no response from the nrf. Only Zeros. (Touchscreen is not connected to the shield)

When I connect the nrf without the shield to the Mega it works.

Can somebody please help me with this?

Edit:

I've also tried softspi. But it is also not working.

Can somebody please help me with this?

Probably not. We don't know which TFT device you are using, so we don't know which pins it uses. If it's an SPI device, it uses a minimum of 4 pins (MISO, MOSI, CLK, and CS).

We don't know what code you have.

This is my code:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>

RF24 radio(8, 9);

const uint64_t pipes[2] = { 0xEEFAFDFDEELL, 0xEEFDFAF50DFLL };


void setup() {

 

  Serial.begin(115200);
Serial.println("Starting...");
printf_begin();
radio.begin();

  radio.setRetries(15, 5);
  radio.setAutoAck(true);
  radio.enableDynamicPayloads();
  radio.openWritingPipe(pipes[1]);
  radio.openReadingPipe(1, pipes[0]);
 
 radio.startListening();
radio.printDetails();
}

void loop() {
  // put your main code here, to run repeatedly:

}

TFT is not connected. Only the shield:

Schematic TFT Shield

On a Mega Pin 53 is the SS pin and must be set as OUTPUT even if you are not using it for SS.

...R
Simple nRF24L01+ Tutorial

Thank you Robin. Unfortunately adding pinMode(53,OUTPUT); makes no difference.

andiaa:
Thank you Robin. Unfortunately adding pinMode(53,OUTPUT); makes no difference.

Can you post a link to the datasheet for the TFT shield?

...R

Robin2:
Can you post a link to the datasheet for the TFT shield?

...R

There is a Link in my Post #2 to schematic. Or do you need something else?

andiaa:
There is a Link in my Post #2 to schematic. Or do you need something else?

I admit I had missed that. But it is not really what I wanted. I am hoping there is a document that describes how the device is used and what limitations it might impose.

As far as I can see it does not connect to pin 53 - which is good news.

But it does seem to be using Pins 0 and 1 (Rx and Tx) which is not good news.

…R

Robin2:
But it does seem to be using Pins 0 and 1 (Rx and Tx) which is not good news.

...R

Why? I've now connected the Touchscreen to the shield to see what happens with the nrf. The Touchscreen is working. Output from NRF radio.printDetails() changed to all 0xfff....

Output from NRF radio.printDetails() changed to all 0xfff…

How does printDetails() show you the data? On the Serial Monitor application?

How do you suppose that the data gets from the Arduino to the Serial Monitor application? Don’t you imagine that the serial port is involved? Don’t you know that that is connected to pins 0 and 1? What is the TFT shield supposed to do with the radio details?

Maybe this can help?

TFT01 Shield Wiki

PaulS:
How does printDetails() show you the data? On the Serial Monitor application?

How do you suppose that the data gets from the Arduino to the Serial Monitor application? Don't you imagine that the serial port is involved? Don't you know that that is connected to pins 0 and 1? What is the TFT shield supposed to do with the radio details?

Output is over Serial Monitor.

I thougth that connecting the TFT may influence the SPI Bus behaviour.

I thougth that connecting the TFT may influence the SPI Bus behaviour.

It does, because that is how the Arduino communicates with the shield.

The "schematic" data they provide is next to useless. It does NOT show how the shield pins connect to the Mega pins, at least not in a way I can read. The image on the site does not scale worth a damn, and I can't read 4 point text on the best day.

The pdf file linked to is better, but it shows that the hardware serial pins are being used for the F_WP and F_HOLD functions. That was plain stupid. There are plenty of other pins that they could have used.

You won't be able to use Serial.print(), Serial.write(), or Serial.read() with that shield in place. Nor will you be able to use any radio functions that use Serial methods.

I agree with @PaulS - especially about the decision to use Pins 0 and 1 for shield purposes.

A possible workaround would be to connect from your PC to Serial1, Serial2 or Serial3 on the Mega using a USB-TTL cable. Then, in your own code you can write to (eg) Serial1 to output stuff to the Serial Monitor. But any code within the RF24 library that tries to write to Serial would still not work.

...R

Ok. But what i don't understand why do I get some debug output with Serial.print when Touchscreen is using this pins?

andiaa:
Ok. But what i don't understand why do I get some debug output with Serial.print when Touchscreen is using this pins?

I don't know.

...R

Problem solved. Spent so much time just to find out that there was a broken wire :confused:

andiaa:
Problem solved. Spent so much time just to find out that there was a broken wire :confused:

Thanks for the update, and welcome to the club. :slight_smile:

...R