Strange nrf24 issue with mega 32u2/328

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not really sure where the problem is here, my guess is in the code...

 

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.

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another Freak Torby has some experience with these modules, I recall him saying there is an issue with them when sending the same data over and over again.  See this: https://www.avrfreaks.net/commen...

Perhaps that will help.

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well that does explain somethings. Does not explain why I can send a 1, then a 1, and repeat by re-plugging in my device.  Somehow the consecutive code is allowed but not a single send the power cycle and repeat. Could be related, ill contact nordic.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S_K_U_N_X wrote:
ill contact nordic.

IIRC the issue was with "cloned" units from china, the real Nordic units do not have the issue!

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ew... How do I know what I ordered? Does anyone have non china version?

 

So I did more testing and this may shed light, not sure...

 

Torby is right (not that I'm suggesting he was not) and if I send a 1, then change my code and rebuild and send a 2 it does work. Where 1 then power it all down and send a 1 again does indeed not work. 

 

but

 

if I send a 1, then send another 1 without powering down my device it works. 

 

So I may not have the same issue. I was pretty sure to buy non china versions. 

 

 

Last Edited: Mon. Apr 13, 2020 - 01:57 PM