nRF24 / RF24

OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
https://nrf24.github.io/RF24
GNU General Public License v2.0
2.22k stars 1.02k forks source link

No radio.available() when using 64x32 RGB display. #476

Closed Vulture-in-the-woods closed 4 years ago

Vulture-in-the-woods commented 5 years ago

Hi.

I'm trying to combine the NRF24L01 with a 64x32 RGBmatrix, using the and ESP32 and P3RGB64x32MatrixPanel.h and Adafruit_GFX.h besides mandatory libraries for the NRF24L01.

The purpose is to send a message (the typeDef Struct I made) and print it on the RGB matrix

Regardless of the NRF24L01 the RGB display works like a charm, but I cannot get the NRF24L01 to work with the display

If I do not initialize the RGBmatrix the receiver code works like a charm, no problem.

And when the code runs, the radio.printDetails(); works as well, but something goes wrong with the radio.available, and I'm going crazy over it:

I've tried for a week now, and nothing in the order of initialization or re calling spi.begin works.

Is this an SPI issue or what?

I'm hoping for enlightenment.

Best Regards

//A lost Vulture in the Woods

The Code:

include

include

include

include // Core graphics library

include

// Radio pins

define CE_PIN 27

define CSN_PIN 26

define CLK_SPI 14 // 18

define MISO 12 // 19

define MOSI 13 //23

define SS 15 // HSPI 15 // Yes same pin as CSN, but it doesn't seem to matter.

//Matrix pins

define R1 23

define G1 22

define BL1 1

define R2 3

define G2 21

define BL2 19

define pin_A 18

define pin_B 5

define pin_C 17

define pin_D 16

define CLK_RGB 25

define LAT_RGB 32

define OE_RGB 33

bool doOnceRadio = true; bool rpdPrint; RF24 radio(CE_PIN,CSN_PIN);

unsigned long timeDifference;

const uint64_t pipe1 = 0xE8E8EEF0A1LL;; const uint64_t pipe2 = 0xA2LL;
const uint64_t pipe3 = 0xA3LL; const uint64_t pipe4 = 0xA4LL; const uint64_t pipe5 = 0xA5LL; const uint64_t pipe6 = 0xA6LL;

typedef struct { char filterChar[1]; bool testBitLED; bool startBit; bool reset1; uint8_t setDiscipline; unsigned long setDuration; unsigned long masterMillis; bool returnResult; uint16_t result; bool switchChannel; bool reset2; } TXstruct;

TXstruct message;

// Matrix pin constructor //P3RGB64x32MatrixPanel matrix; // default constructor P3RGB64x32MatrixPanel matrix(R1,G1,BL1,R2,G2,BL2,CLK_RGB,LAT_RGB,OE_RGB,pin_A,pin_B,pin_C,pin_D);

void setup() {

 Serial.begin(115200);

// Matrix initialization matrix.begin(); matrix.setTextSize(1); // size 1 == 8 pixels high matrix.setTextWrap(false); // Don't wrap at end of line - will do ourselves

 // Start up Screen text:

matrix.setTextColor(matrix.color555(1,15,31)); matrix.setCursor(11, 2); matrix.println("Display"); matrix.setTextColor(matrix.color555(31,15,1)); matrix.setCursor(20, 12); matrix.println("Test"); matrix.setTextColor(matrix.color555(31,1,1)); matrix.setCursor(20, 22); matrix.println("Radio");

 SPI.begin(CLK_SPI,MISO,MOSI,SS);

radio.begin(); radio.openReadingPipe(1,pipe1); // (1, const uint8_t *address) Pipe number (usually 1), pipe address (which is usually 5 bytes in an array structure). radio.setPALevel(RF24_PA_MIN); // RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX radio.setDataRate(RF24_2MBPS); // 500kBPS 1MBPS 2MBPS radio.enableAckPayload(); radio.setRetries(15,15); radio.setChannel(108); // 0-124

radio.startListening(); }

void loop() {

if(doOnceRadio){ radio.printDetails(); doOnceRadio = false; }

if (radio.available()) {

radio.read(&message, sizeof(message));

timeDifference = message.masterMillis-millis();

//if(message.filterChar[0]=='H'){ // Check character to ensure no unvalid data enters
Serial.print("Filter char ");
Serial.print(message.filterChar[0]);
Serial.print(" Set LED");
Serial.print(message.testBitLED);
Serial.print(" START? ");
Serial.print(message.startBit);
Serial.print(" reset? ");
Serial.print(message.reset1);
Serial.print(" ");
Serial.print(message.reset1);
Serial.print(" Disipline ");
Serial.print(message.setDiscipline);
Serial.print(" Duration ");
Serial.print(message.setDuration);
Serial.print(" Master Millis ");
Serial.print(message.masterMillis);
Serial.print(" Return Result ");
Serial.print(message.returnResult);
Serial.print(" Result ");
Serial.print(message.result);
Serial.print(" Switch CH? ");
Serial.println(message.switchChannel);
 //} end of if(message.filterChar[0]=='H')

delay(1000); } // End of if (radio.available()) } // end of void loop()

Relevant_libraries.zip esp32-pinout-for-vw_kbc_rgb_matrix_w_spi

TMRh20 commented 4 years ago

Old issue, but just for the record:

Pretty sure this is related to https://github.com/espressif/arduino-esp32/pull/3730 Temporary fix may be to add #define RF24_SPI_TRANSACTIONS to RF24.cpp