Dear Robin,
you are right, something goes in conficts with the SPI parameters of the "RF24.h" and "Adafruit_ILI9341.h" libs when using both the hardware SPI ( maybe they have different speed, mode, etc ).
I found a very deep investigation by googling "Using nrf24l01+ with other devices together on one SPI-Bus"...
The nRF24L01+ remains hooked somewhere and not responding if it shares same hardware SPI with the TFT.
I SOLVED leaving the TFT over hardware SPI (it is fast enought now) and moving nRF24L01+ to a software SPI.
To move nRF24L01+ over a software SPI i did in this way:
- edited RF24_config.h and UNcommented #define SOFTSPI (it was //#define SOFTSPI)
- added DigitalIO lib to my project
- wired nRF24L01+ MISO, MOSI, SCK of to pin 9, 8, 7 of my arduino MEGA
this is my lib including:
#include <SPI.h>
#include <RF24.h>
#include "DigitalIO.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
this is how are created the two instances of the objects:
//TFT
#define TFT_DC 44
#define TFT_CS 46
#define TFT_RST 48
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); // remaining pin to hw spi 50,51,52
//radio
RF24 radio(41,40); // ce, cs
It took 2 weeks of my life, but I can now go on with my project.
Thanks a lot
Andrea