nRF24L01 blocks operation OpenSmart TFT display

Dear all,
I am looking for help because, despite of many days of reading, googling and experimenting, I fail to run my TFT display after my nRF024L01 module is initialized.

My goal is to build a wireless controlled dog training device, with an Arduino + TFT Touchscreen + a nRF24L01 radio module as controller. The device itself (I call it the 'Launcher') is managed by another Arduino and will have a second nRF24L01 connected.
I am not new to computer controlled systems, but entered the Arduino world only some months ago. I developed the various sub-systems stand-alone first, and now get stuck in the stage of merging parts together.

The hardware:
I bought an OpenSmart 3.5" TFT-display with Touch-function, 240x400pixels, SPI interface with a ST7793 driver, mounted on a 16 pins shield, together with an OpenSmart ONE R3 Air Arduino clone.
For the wireless communication I initially bought two 'nRF24L01+ plus PA plus LNA' boards plus external antenna, plus two YL106 adapter boards for easy 3.3V supply. In a later stage I also bought three EBYTE E01-ML01DP5 boards, which should be the shielded version of the two I already had.

The software:
I installed the 'Adafruit_GFX' library and the "special version" of the 'MCUFRIEND_kbv' library the seller pointed me to with stringent warning NOT TO USE the version, supported by Arduino. After some struggle I got the display and touchscreen working.
I got the nRF24 examples for 1way and 2way communication running, stable for long time.

The problem:
I added a radio module to the Arduino with the display, electrically (pin13 for SCK, pin12 MISO, pin11 MOSI, pin2 for CE and pin3 for CSN) and the code (some initialization in 'setup()' and a simple 'radio.write(...)' in 'loop', mixed with some display actions. The display actions appear not effective after the first radio statement!
When I comment out the initialization of the radio, the display fails later, after the call 'radio.write(...)'. Without the 'radio.write', the display is functioning well. I also checked the radio: it seems to work normally for a simple 1way send action (the receiver gets the sent number).
This afternoon I checked the 'CSN' signals for both devices with a decent scope: it looks OK, no simultaneous use of the SPI bus.
Unfortunately, I fail to add the code for my testing in the preferred way, maybe I can do this later.

I hope someone is willing and capable to help me out, I will appreciate that very,very much, as I struggle already many days without result.
Thanks in advance,
Fred

A second attempt to add my code for testing:

// IMPORTANT: Adafruit_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h FOR SETUP.
//by Open-Smart Team and Catalex Team
//catalex_inc@163.com
//Store:   http://dx.com
//           https://open-smart.aliexpress.com/store/1199788
//Demo Function: Display graphics, characters
//Arduino IDE: 1.6.5
// Board: Arduino UNO R3, Arduino Mega2560,Arduino Leonardo

// Board:OPEN-SMART UNO R3 5V / 3.3V, Arduino UNO R3, Arduino Mega2560
//3.2INCH TFT:
// https://www.aliexpress.com/store/product/3-2-TFT-LCD-Display-module-Touch-Screen-Shield-board-onboard-temperature-sensor-w-Touch-Pen/1199788_32755473754.html?spm=2114.12010615.0.0.bXDdc3
//OPEN-SMART UNO R3 5V / 3.3V:
// https://www.aliexpress.com/store/product/OPEN-SMART-5V-3-3V-Compatible-UNO-R3-CH340G-ATMEGA328P-Development-Board-with-USB-Cable-for/1199788_32758607490.html?spm=2114.12010615.0.0.ckMTaN


#include <Adafruit_GFX.h>    // Core graphics library
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

//***********************************************//
// If you use OPEN-SMART TFT breakout board                 //
// Reconmmend you to add 5V-3.3V level converting circuit.
// Of course you can use OPEN-SMART UNO Black version with 5V/3.3V power switch,
// you just need switch to 3.3V.
// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
//----------------------------------------|
// TFT Breakout -- Arduino UNO / Mega2560 / OPEN-SMART UNO Black
// GND                -- GND
// 3V3                -- 3.3V
// CS                 -- A3
// RS                 -- A2
// WR                 -- A1
// RD                 -- A0
// RST                -- RESET
// LED                -- GND
// DB0                -- 8
// DB1                -- 9
// DB2                -- 10
// DB3                -- 11
// DB4                -- 4
// DB5                -- 13
// DB6                -- 6
// DB7                -- 7

// Assign human-readable names to some common 16-bit color values:
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

// include files for the wireless communication:
#include <nRF24L01.h>
#include <RF24.h>

// ===============================================================================
// Globally instantiate a (2.4GHz) radio object and some parameters:
RF24 radio(2, 3);                                     // CE (ChipEnable pin), CSN (ChipSelect pin)
// ===============================================================================

// Defines and global declarations for the radio functions:
#define RADIO_AUTO_ACK_ON             true
#define RADIO_SET_DATARATE            RF24_250KBPS
#define RADIO_SET_CRCLENGTH           RF24_CRC_8
#define RADIO_SET_CHANNEL             76
#define RADIO_SET_RETRIES_DELAY       5
#define RADIO_SET_NR_RETRIES          15
#define RADIO_SET_PA_LEVEL_MIN        RF24_PA_MIN
#define RADIO_SET_PA_LEVEL_LOW        RF24_PA_LOW
#define RADIO_SET_PA_LEVEL_HIGH       RF24_PA_HIGH
const byte  radio_Addresses[][6] = {"00001", "00002"};     // array with radio_Addresses for transmit and receive channel


uint16_t g_identifier;

void setup(void) {
  Serial.begin(9600);
  Serial.println(F("TFT LCD test"));

#ifdef USE_OPENSMART_SHIELD_PINOUT
  Serial.println(F("Using OPENSMART 3.5\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using OPENSMART 3.5\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is ");
  Serial.print(tft.width());
  Serial.print("x");
  Serial.println(tft.height());

  tft.reset();                      		//we can't read ID on 9341 until begin()
  g_identifier = tft.readID();
  Serial.print("ID = 0x");
  Serial.println(g_identifier, HEX);
  
  tft.begin(0x7793);						//to enable ST7793 driver code
  tft.setRotation(0);
  
  Serial.println(F("Benchmark                Time (microseconds)"));
  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);
 
  Serial.println(F("Done!"));

  init_Radio_as_Transmitter();				// initialize + configure the Radio
}

void loop(void) {
  bool result;
  for(uint8_t rotation=0; rotation<4; rotation++) {
  	tft.fillScreen(BLACK);
    tft.setRotation(rotation);
	  tft.setCursor(0, 0);
    tft.setTextColor(WHITE);  tft.setTextSize(1);
    tft.print(rotation);
    testText();
    delay(500);
  }
  radio.stopListening();
  delay(20);
  result = radio.write(&g_identifier, sizeof(g_identifier));       // send just a 2byte number
  Serial.print("radio: try send: ");
  Serial.print(g_identifier);
  Serial.print(", result: 0x");
  Serial.println(result, HEX);
}

unsigned long testText() {                                                          // draw something on the display
  tft.fillScreen(BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  return micros() - start;
}

/*
 * Initialise the 2.4GHz radio communication as Transmitter that can receive also:
 */
void init_Radio_as_Transmitter(void) {

  radio.begin();
  radio.openWritingPipe(radio_Addresses[0]);            // 00001
  radio.openReadingPipe(1, radio_Addresses[1]);         // 00002
  if (RADIO_AUTO_ACK_ON)                                // define ACK <on>/<off>
    radio.setAutoAck(true);
  else
    radio.setAutoAck(false);
  radio.setChannel(RADIO_SET_CHANNEL);                  // define the radion channel
  radio.setDataRate(RADIO_SET_DATARATE);                // define the radio DataRate
  radio.setCRCLength(RADIO_SET_CRCLENGTH);              // define the radio CRC
  radio.setRetries(RADIO_SET_RETRIES_DELAY, RADIO_SET_NR_RETRIES);  // define the radio retry parameters
  radio.setPALevel(RF24_PA_MIN);                        // define the radio transmit power
  radio.startListening();                               // radio should listen almost constantly)
  
} // end of 'init_Radio_as_Transmitter()'

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.