This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I can only send data one time

Not really sure where the problem is here, my guess is in the code...
I just recently saw this: https://www.avrfreaks.net/comment/1342846#comment-1342846


Although my issue is not really the same. IS there something I need to know about sending repeated data?

I will need to send the same byte very often. but on to my particular issue.

To put this is words... I can only send data one time, unless I send more then 1 byte. - As pathetic is that sounds that is the case.

One of my devices is an arduino the other AVR chip (my own project) mega32u2. I put the arduino in listen mode and my device sends data as soon is its powered up.

 

code version 1.

plug in mega32us
setups up SPI
talks to nrf24
sets up registers
sends 1 byte

 

arduino sees this this byte.
 

unplug mega32us
plug in mega32us
setups up SPI
talks to nrf24
sets up registers
sends 1 byte

 

arduino. does not see the byte. Must power cycle the arduino and the nrf24 for it to work again.

 

 

 

 

code version 2.

 

plug in mega32us

setups up SPI
talks to nrf24
sets up registers
sends 1 byte

sends another byte

 

arduino sees this these byte.

 

unplug mega32us
plug in mega32us

setups up SPI
talks to nrf24
sets up registers
sends 1 byte

sends another byte

 

arduino sees this these byte.

 

...etc...

 

 

Nothing supper special in the code.

 

MEGA32u2

wirelessInterface->init();

_delay_ms(2);

wirelessInterface->write(1,1); //size,data

_delay_ms(1);

wirelessInterface->write(1,1);

will work every time without fail.

 

but this:

wirelessInterface->init();

_delay_ms(2);

wirelessInterface->write(1,1); //size,data

works once.

 

arduino code.

while (radio.available())

{

radio.read(ReceivedMessage, sizeof (ReceivedMessage) );

Serial.println(ReceivedMessage[0], HEX);

}

setup

radio.setChannel(2);
const byte add[5] = {1,1,1,1,1};
radio.setPayloadSize(1);//

I assume this is where I steered wrong but this is correct...
radio.openReadingPipe(0, add);

 

I have 20 nrf24 boards and not from the same seller. They all act the same. My analyzer attached to the transmitter looks good. I can also read all register back, and they are set up correctly.

 

Related