I'm not quite sure what I'm not doing correctly. Hopefully you can help me out. My pin connections:
ATtiny84 -> Nrf24L01+
MISO (PA6) -> MISO
MOSI (PA5) -> MOSI
SCK (PA4) -> SCK
CSN (PA3) -> CSN
CE (PA2) -> CE
The code uploads to the ATtiny84 perfectly well, and seems to be working.
When I run the uno code you provided, though, it fails to detect any data. Here are the connections:
UNO -> Nrf24L01+
D9 -> CE
D10 -> CSN
D11 (MOSI) -> MOSI
D12 (MISO) -> MISO
D13 (SCK) -> SCK
And here is the stripped down code:
ATTinyMirf.ino
#include <avr/io.h>
#include <inttypes.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <SPI85.h>
#include <Mirf85.h>
#include <nRF24L0185.h>
#include <MirfHardwareSpiDriver85.h>
#include "SoftwareSerial.h"
byte data[32] = {
'T','T','W','I','R','E','L','E','S','S','Q','Q','Q','Q','Q','Q',
'Q','Q','R','J','F','E','D','O','R','Q','Q','Q','Q','Q','Q','Q'
};
SoftwareSerial mySerial(9,10);
void setup(){
mySerial.begin(9600);
mySerial.write("ATTINY - Setup\n");
// pinMode(3,0);
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
// digitalWrite(3,1);
delay(1000);
Mirf.cePin = 2; //attiny
Mirf.csnPin = 3; //attiny
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"sendr");
Mirf.payload = 32;
Mirf.channel = 8;
Mirf.setTADDR((byte *)"reply");
Mirf.send(data);
delay(3000);
mySerial.write("ATTINY - End Setup\n");
}
void loop(){
delay(1000);
digitalWrite(0, HIGH);
mySerial.write("ATTINY - Sending... \n");
Mirf.send(data);
digitalWrite(0, LOW);
delay(100);
}
and for the UNO:
UnoMIRF.ino
//mirf recieve and replay
/*
PIN ||arduino || mirf
GND || GND || 1
VCC || 5V || 2
CE || 9 || 3
CSN || 10 || 4
SCK || 13 || 5
MOSI|| 11 || 6
MISO|| 12 || 7
IRQ || NA || 8
*/
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
byte data[32]; //size of payload
void setup(){
Serial.begin(9600);
//begin nrf24ll01
Mirf.cePin = 9; //uno
Mirf.csnPin = 10; //uno
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"reply");
Mirf.setTADDR((byte *)"sendr");
Mirf.payload = 32;
Mirf.channel = 8;
Mirf.config();
Serial.println("Setup finished");
}
void loop(){
// Serial.print(".");
if(Mirf.dataReady()){
Mirf.getData(data);
delay(50);
for (int i = 0; i < 32; ++i)
{
Serial.print(data[i]);
Serial.print(",");
}
Serial.println();
}
}
I'm pretty sure the chips themselves work; the RF24 library was able to get the status register of the transceivers, so it must be a problem with the ATtiny and/or Uno code
Thank you again