LowPowerLab Forum

Software support => Coding questions => Topic started by: enrique34 on November 24, 2021, 03:35:27 PM

Title: RFM69 strange behaver
Post by: enrique34 on November 24, 2021, 03:35:27 PM
Hello everyone;
i'm trying to find out a strange behaver of my RFM69HW module.

i've two boards that are Slave and Master. Basicly Master board sends a command to Slave board to get temperature value.


the code of  the Master side:


for(uint8_t i=0;i<3;i++)  //try to send 3 times
{
sending_error=1;           
try_sending_count++;
RFM69_send(slave_id,"get",3,false); //send the command data to get temperature value from Slave
for(uint16_t j=0;j<100;j++)     // wait 100ms the data coming from slave
{
    delay_ms(1);
    if(receiveDone()==1)
    {
      sending_error=0;
      data_process();
      goto next;
    }
}
}
next:




the code of the slave side:

if(receiveDone()==1)
{
  RFM69_send(master_id,temp,1,false); //send the temp value to Master
  blink_led(); 
}


when i run the two side Master sends requesting to Slave every 1000ms
BUT Slave can not get every commands coming from Master even if they are close each other.

when i change both side such this:

MASTER :

for(uint8_t i=0;i<3;i++)  //try to send 3 times
{
RFM69_send(slave_id,"get",3,false); //send the command data to get temperature value from Slave
delay_ms(500);
}





SLAVE :

if(receiveDone()==1)
{
  blink_led(); 
}


Slave can get all data coming from Master and i can see every requesing via blinking led.

in additionally when i change such that :
MASTER :

for(uint8_t i=0;i<3;i++)  //try to send 3 times
{
sending_error=1;           
try_sending_count++;
RFM69_send(slave_id,"get",3,false); //send the command data to get temperature value from Slave
for(uint16_t j=0;j<100;j++)     // wait 100ms the data coming from slave
{
    delay_ms(1);
    if(receiveDone()==1)
    {
      sending_error=0;
      data_process();
      goto next;
    }
}
}
next:




SLAVE :

if(receiveDone()==1)
{
  RFM69_send(master_id,temp,1,false); //send the temp value to Master
  RFM69_send(master_id,temp,1,false); //send the temp value to Master
  RFM69_send(master_id,temp,1,false); //send the temp value to Master
  blink_led(); 
}


in this situation Slave can send successfully.

BUT it is a trick is not a technic.

i think that if master or slave are in RxMode after TxMode or TxMode after RxMode, they can't do next mode successfully.

i hope what i want to tell you guys...
Thanks.