Hello guys i am experimenting with the nrf24l01+ module. The connection is a bit like follows:
1st atmega8:
---| |
---| m8 |
inputs ---| |
to ---| |
1st atmega8 ---| |
---| |-|1st |
---| |-|nrf24l01+|
2nd atmega8:
---| |
---| m8 |
2nd atmega8 ---| |
to ---| |
leds ---| |
---| |-|2nd |
---| |-|nrf24l01+|
(Both contain the remaining interfacing for the m8; both the m8 are running at 3.3v through a ams1117 regulator, same power going to their radios; both radios have 10uf connected to their power pins; both regulators being powered by 5v 2A adapters, with capacitors on both input and output side)
Now what i am trying to do is blink the led corresponding to the input which goes 0(internally pulled up). So i wrote the sketches and made the circuit one by one. First, trying to get the inputs from the 1st m8, i read the data incoming with raspberry pi and arduino- that was successful without any problems. After that i did the 2nd circuit and wrote sketch for it and that is where the weirdness began:
When i tested it with raspberry pi by sending the data with raspberry pi it was successfully working without any problems. But when i tested it along with the 1st transmitter circuit, the radio appears to get locked in the 2nd rx circuit which is really weird. Sometimes the 1st transmission came and after that the radio appeared to be locked up(not the atmega8, i checked by adding external switch to the rx circuit and changing leds). With the condition being unchanged(1st transmission came then circuit didn't change), i tested first by raspberry pi to check if tx was sending data properly which it was, then tried sending data from raspberry pi to the rx radio and it wasn't receiving anything(checked from ack). Now, after that i reset the rx circuit and tried sending data by raspberry pi, then stopped sending, then started sending again and all the data was received successfully, all acks were received by the pi.
This is what has stumped me why does the nrf24l01+ keeps getting locked when getting data from 1st tx circuit and works normally when used with raspberry pi -_- (if there was a medium/channel/data type problem then both shouldnt be working; if there was a problem in the program then again both shouldnt be working)
The initialization of the radio should give the details about the talking medium(using tmrh20's rf24 library)
The initialization code for tx:
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
const uint64_t pipes[2] = {0xCDEF123456,0x65ee04452e};
void setup()
{ radio.begin();
radio.setChannel(108);
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);
radio.setAutoAck(1);
radio.setRetries(5,15);
radio.setCRCLength(RF24_CRC_16);
radio.enableDynamicPayloads();
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.stopListening();
DDRD=0x00; PORTD=0xff;
}
At rx side:
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
const uint64_t pipes[2] = {0xCDEF123456,0x65ee04452e};
void setup()
{ radio.begin();
radio.setChannel(108);
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);
radio.setAutoAck(1);
radio.setRetries(5,15);
radio.setCRCLength(RF24_CRC_16);
radio.enableDynamicPayloads();
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.startListening();
DDRD=0xff; PORTD=0xf7;
}
(Same tx rx options working on raspberry pi too)
Please someone help me with this i am really confused. Thank you for your time!