Hello all, I am working on a project, interfacing the nRF24L01+ with the ATTiny84, and I am having issues. Here is my code and wiring diagram:
#include <nRF24L01.h>
#include <RF24.h>
#define CE 2 // CE on PA2
#define CSN 3 // CSN on PA3
#define NO 9 // NO on PB1
#define OK 10 // OK on PB0
RF24 doorBellRadio(CE, CSN); // create an instance of the class RF24
void setup()
{
while(!doorBellRadio.begin()) // try to start radio
{
//Serial.println("Failed to start radio...");
digitalWrite(NO, HIGH);
digitalWrite(OK, LOW);
delay(500);
digitalWrite(NO, LOW);
digitalWrite(OK, LOW);
delay(500);
}
digitalWrite(OK, HIGH);
digitalWrite(NO, LOW);
delay(5000);
}
void loop()
{
// do nothing for now
}
I am using LEDs named "OK" and "NO" as a debugging tool since the ATTiny84 doesn't have a serial port. So these let me know when the radio fails or loads. My issue right now is that doorBellRadio.begin() always fails. I have verified and reverified my wiring over and over again. I have edited the RF24.cpp (I am using the 1.3.2 version of the RF24 library) file to ensure that the library is calling the correct pins of the ATtiny84. And, I have commented out the lines
in the RF24_config.h file as well. If anyone knows what I might be doing wrong, I appreciate your help! Also, here is the pinout that I am following for the ATtiny84:
The RF24 lib should be working out-of-the-box with ATTiny 84. There should typically be no need to edit the RF24 files.
If radio.begin is failing, it indicates a basic communication failure between the radio and MCU. This is usually due to bad wiring, pin connections etc and indicates a need to verify the main MISO MOSI and SCK pins.
Using the Arduino IDE to compile the code for the ATTiny84, I kept receiving error messages because of the RF24 library. It had something to do with missing definitions of pins, so that's why I switched over to an older version of the RF24 library.
I was able to program the uC using an Arduino Nano with the basic blink sketch (and an external interrupt via a pushbutton). So I know that I have the correct SPI pins for programming it, but the communication between the uC and the nRF24 radio module fails.
Ok, I just recompiled the code from above, and I didn't get any error messages this time. Weird. I don't know why I was getting those messages before. I know I was doing something wrong, I just don't know what it is.
For the project I was working on, I had to upgrade from an ATTiny84 to a Nano for other reasons, so I am not even working with the Tiny anymore. Thank you for the help though, and sorry for the trouble. I will definitely be working with the ATTiny84 and nRF24 in the near future though.