Using nRF24L01 wireless chip with Gamebuino Meta

Arcane

il y a 4 ans

Im having problems using the nRF24L01 chip with Gamebuino Meta using the library RadioHead.  I am confident with my wiring connecting the back of the Gamebuino to chip of:

GND -> GND,   3V3 -> VCC,   8 -> CS,   10 -> CSN,   SCK -> SCK,   MOSI -> MOSI,   MISO -> MISO

I suspect that the issue may be related to clock speeds of the SPI bus, I am not experienced in this field, but I can see that there is code setting frequency in the RadioHead library, but I fear this may not be compatible with Gamebuino directly.

I have successfully initialized the chip with a separate Arduino Nano using the same setup, and I can confirm it is operational.  But when on Gamebuino the device fails to initialize, with the code below it outputs "> init failed" ;

#include <Gamebuino-Meta.h> 
#include <SPI.h>
#include <RH_NRF24.h>
RH_NRF24 nrf24(8,10);
char msg[1];
void setup(void){
  gb.begin();
  gb.display.clear();
  gb.lights.clear();
  Reset();
}
void loop(void) {
  while(!gb.update());
  while (nrf24.available()) {
    uint8_t len = 1;
    nrf24.recv((uint8_t)msg, &len);      
    gb.display.print(msg[0]);
    nrf24.send((const uint8_t)msg, 1);  
  }
  if (gb.buttons.pressed(BUTTON_A)) {
    if (Reset()) gb.sound.playOK();
    else gb.sound.playCancel();
  }
}
bool Reset() {
  gb.display.clear();
  gb.display.print("> ");
  gb.display.println(millis()); 
  if (!nrf24.init()) {
    gb.display.println("> init failed");
    return false;
  }
  if (!nrf24.setChannel(1)) {
    gb.display.println("> setChannel failed");
    return false;
  }
  if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm)) {
    gb.display.println("> setRF failed");
    return false;
  }
  gb.display.println("> Radio listening");
  return true;
}

Please note that I am new to the Gamebuino and its whole system.  Unsure of what to do, any help is greatly appreciated! ^^

Steph

NEW il y a 4 ans

Hi,

I've never played with the electronic ecosystem for Arduino before, but I'll start looking at it soon.

Take a look at this video, you'll probably find a solution:

The NRF initialization is addressed at 8:37. But I encourage you to watch the whole video.

Thorgan

NEW il y a 4 ans

There is another spi slave on the bus, I bet it's the screen.
Pins can be shuffled on this modules as well. I'd try the init sequence on a standalone arduino before anything else...

For your tests, limit the transmit power as the two modules you will use may be very close.

If you don't care about performance, consider soft SPI.

Thierry

NEW il y a 4 ans

From what I saw here, there is also buttons on the SPI bus.

But as it is a shareable bus, @Thorgan suggestion is very good: first try this on a genuine arduino

Arcane

NEW il y a 4 ans

I managed to get a workaround working, using a software SPI using some free pins.  I would still like to get any advice on using the main SPI interface.  I have run into another problem with the two modules not communicating, but I think this does not fit with this topic.