nRF24L01+ with 1.77" TFT module

I'm working on a project to receive data by nRF24L01+ and show on 1.77" TFT module.
The nRF24L01+ and TFT module works well separately.
When put together on Duemilanove board, the TFT module still can show me some text.
But the nRF24L01+ is not working, and the radio.printDetails() gets nothing, looks like below:
Can anybody help?

STATUS		 = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1	 = 0x0000000000 0x0000000000
RX_ADDR_P2-5	= 0x00 0x00 0x00 0x00
TX_ADDR		 = 0x0000000000
RX_PW_P0-6		 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA		 = 0x00
EN_RXADDR	 = 0x00
RF_CH         = 0x00
RF_SETUP	 = 0x00
CONFIG		 = 0x00
DYNPD/FEATURE	= 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01
CRC Length	 = Disabled
PA Power	 = PA_MIN

I followed the wiring tutorial of TFT module :
sd_cs : pin 4
lcd_cs : pin 10
d/c : pin 9
reset : pin 8

The nRF24L01+ is wiring as below:
CE : pin 7
CS : pin 6

Here is the code?

#include <SPI.h>
#include <SD.h>
#include <TFT.h>  // Arduino LCD library
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"


// pin definition for the Uno
#define sd_cs  4
#define lcd_cs 10
#define dc     9
#define rst    8 

TFT TFTscreen = TFT(lcd_cs, dc, rst);


//
// Hardware conf
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10 

RF24 radio(7, 6);

//
// Topology
//

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
char buffer[PAYLOAD_SIZE];

void setup(void)
{

  // initialize the GLCD and show a message
  // asking the user to open the serial line
  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  TFTscreen.stroke(0, 0, 255);
  TFTscreen.println();
  TFTscreen.println("Arduino TFT Bitmap Example");
  TFTscreen.stroke(0, 0, 0);

  //
  // Print preamble
  //

  Serial.begin(9600);
 printf_begin();


  // clear the GLCD screen before starting
  //TFTscreen.background(255, 255, 255);
  
  // try to access the SD card. If that fails (e.g.
  // no card present), the setup process will stop.
  Serial.print("Initializing SD card...");
  if (!SD.begin(sd_cs)) {
   Serial.println("failed!");
    //return;
 }
  Serial.println("OK!");

  //
  // Setup and configure rf radio
  //

  radio.begin();
  radio.setRetries(15,15);
  //radio.setChannel(0x4c);
  //radio.setPALevel(RF24_PA_MAX);
  //radio.setDataRate(RF24_2MBPS);
  //radio.setPayloadSize(PAYLOAD_SIZE);

  radio.openWritingPipe(pipes[0]);
  radio.openReadingPipe(1,pipes[1]);
  radio.startListening();
  radio.printDetails();
  printf("PayLoadSize : %d\n",  radio.getPayloadSize());
}

void loop(void)
{
  unsigned long message;
  if ( radio.available() )
  {
    printf("radio.available!\n");
   radio.read( &message, sizeof(unsigned long) );
    TFTscreen.println("message get : %ld\n", message);
  }
}

I found the SPI clock divider is set to 24 in Adafruit_ST7735.cpp.
So I modified clock divider from SPI_CLOCK_DIV4 to 24in RF24.cpp to match TFT module.
But, still not working.

What happens if you have it all assembled but just don't enable the LCD, either by not calling .begin() or with the enable lines (4, 10) disconnected? In other words, does the radio still work while the LCD and SD are loading down your power source?

The radio won't work as long as the 5V, Gnd and 3 SPI wires(CLK, MOSI, MISO) of the TFT module are connected.
Even the TFT .begin() is not called.

I've followed the advice of others here and now make sure i install a 10uF capacitor across the 3.3V close to the radio module. That's improved reliability for me.

However, I am surprised that you seem to be reading 'all zeros'. For me a non functioning module was usually giving 'all ones' in the printDetails(). Maybe the Due just doesn't give you adequate 3.3V supply with the other device connected.

I use a 5V/4A adapter to power up Duemilanove, and even remove the backlight pin of LCD. Sadly the RF module is still not working.

JohnHoward:
Maybe the Due just doesn't give you adequate 3.3V supply with the other device connected.

Because the Due is a 3v3 board, it has significantly greater capacity than the 5V AVR boards on the 3v3 rail. So I don't think you would simply out of mA to run the nRF24L10+ on the Due, even with the TFT display connected (although it would be helpful to know what the power requirements for the display.actually are.)

However, the Due power rail is not the cleanest in the world (better than the Megas, which can be terrible, but not as good as an Uno, say). And the nRf24L01+ modules are generally fussy about their power supply -- they like it nice and clean.

So my guess is that it would be an issue of the quality rather than of quantity regarding the power supply when the TFT display is attached. Noisy device? Without a scope it would be impossible to check directly, but you could try cleaning it up with some decoupling caps. Some 0.1uF ceramics, and perhaps experiiment with an electrolytic > 10uF.

The other possibility is that you do have some bad behaviour on the SPI bus. Try disconnecting just the MISO connection from the TFT display and see if that allows the radio to work. There is a possibility is holding MISO low leading to all the zeroes -- are you controlling it as per the data sheet with respect to CS? If the TFT CS is not getting the correct input value from the Arduino, that could well be what's causing the problem.

This is the cause. The radio works when the MISO of the TFT screen is disconnected.
Does that means the official arduino TFT library does not have good behavior on SPI bus?
Any other recommended library for TFT display?

Jock4319:
This is the cause. The radio works when the MISO of the TFT screen is disconnected.
Does that means the official arduino TFT library does not have good behavior on SPI bus?
Any other recommended library for TFT display?

Three possible reasons for the error:

  1. Library bug(s), as you suggest
  2. Programmer error (you). That is, the functionality is provided by the library, but you are not calling the functions or method to deselect the TFT display at the appropriate time.
  3. Wiring error (you). The pin configured as SS/CS/CSn in the software (either your code or the library code) is not connected to the TFT display as required.

I'm not sure if you fully understand how a SPI bus works, but essentially it is a one-device-at-a-time deal. Although more than one device can be connected to the same SPI bus, only one device can be "active" (or "selected") at a time. A device is put into its selected or deselected state by a gpio pin output from the master device (the Arduino) to the SS/CS/CSn input on the slave device (SS = "slave select", CS = "chip select", CSn = "chip select (negated)" -- all different names you will see for the same idea). Each device must have a separate, dedicated gpio pin for this purpose, as it makes no sense to have two slave devices active at the same time, as they will only interfere with each other (as you are seeing).

Normally, the select state is LOW and the deselect state is HIGH (but can be the other way around, depending on the device, and you would normally consult the datasheet.) If it's not working one way, it usually doesn't take long to figure out that the other way works.

Anyway, double-check your slave select set-up for the TFT display, make sure the pin you have connected up for this is the one that is configured in the software (both your sketch and the lib.) Sometimes, lazy lib writers will assume that a device is the only one on the SPI bus, and never deselect the device, or even provide a command to manually deselect it. Other times, the problem will be that a particular pin is hard coded to be the SS/CS/CSn output for that device, and that pin is being used by something else, causing a conflict. A well-written lib makes this configurable.

It's actually because of problems like these I provide a second "software SPI" header connected to an alternative set of pins for the nRF24 module on my nRF24 shields -- sometimes its simpler to just use a second set of pins rather than sharing the SPI bus if there is a device connected to it that really doesn't want to play nicely (or there are just other reasons you'd rather not use the hardware SPI bus.)

In any case, you will need to understand exactly what the mechanism is used to specify and control the slave select/deselect function in your program, and make sure the hardware wiring agrees with the software assumptions. Or, if you just can't get them to share the bus nicely for some reason (broken hardware or hardware design), then you will need to put them on separate sets of pins -- but really shouldn't be necessary in most situations.

HTH. Merry Christmas! :slight_smile:

I know this thread is a bit old but wanted to add this note for anyone who stumbled upon it.

I had so many issues getting my 2.2 TFT display to work WITH the nrf24l01+ and after adding capacitors and shortening wires and following tips that worked for others I still had no luck...

My problem was immediately fixed when I stopped using pin 10 as my CS pin. I had the TFT screen using pin 10 and my nrf24l01+ was using some other pin (14 I think, or 15 idk). Once I switched it to where neither of them were using pin 10 all my problems disappeared.

All those other tips definitely helped though. My packet integrity is much better. I just wanted to add this for others having my issue.

This was done on an Uno (knock off) using the RF24 library for the wireless module and the mfGFX library in conjunction with the ILI9340 as my graphics libraries. (I use mfGFX so I can use custom fonts).

Thanks again everyone for all the helpful tips too.

I've been having similar issue with a little 0.96" OLED display sharing the SPI bus with a NRF24L01+. Actually, it was a little different in that the NRF24L01+ works fine, but the OLED display would display gibberish if the NRF24L01+ was used in any way.

My conclusion was that the OLED display wasn't playing nicely on the SPI bus. I had never considered using a separate software SPI connection for one of the devices. Nor have I tried avoiding pin 10. I'll give both of these a try when I get a chance.

Hello,

I am facing exactly the same problem of nrf24l01+ registers 'zero' when trying to put onboard Arduino Mega 2560 along with TFT 1.77' screen. The library for TFT is the default one that comes along with arduino 1.6.3. The pin connections for SPI (except SS) for nrf24L01+ and TFT are jointly connected with hardware SPI (i.e. 50, 51 and 52 pins of Mega). LCD_CS for TFT is connected to pin 53 while nrf24l01+ CSN is connected to pin 10 (also tried with different pins). TFT power is supplied from +5v of Mega while 3.3V is connected to nrf24l01+. The sketch uploaded on Mega is attached. If I remove MISO connection to TFT, the nrf shows valid register values. Please help.

Thanks in advance.

helloWorldRx.ino (702 Bytes)

old post, but still have the same $&$%@ problem.

Arduino DUE with Arduino TFT with nRF24L01+ (sparkfun)

RF24.h

I tried everything on this post with no success, any futher help ?

Regards,

AB

Wow ---- I recently got the TFT 1.8 and having the same issue when connecting the nRF24L01+ with 1.8" TFT module. When connected separately both modules work fine but once connected together I only receive gibberish on the TFT module via data received with the nRF24L01 module.