Ping pong example doesnt work

I have made a simmilar post yesterday but have noticed something bigger today. Even the normal ping pong example without making it faster gets stuck in rx mode within a minute? Just opened ping pong example changed the frequency and ran it. Both boards are in rx mode rather than one in rx mode and one in tx mode. Please help i need this example to work since i have made a more complicated program based on this and it neither works.
Board heltec esp32 lora v2. Frequency 433-510.


then they both just stopped transmitting because both boards are expecting a message? Thats just my assumption.

#include "LoRaWan_APP.h"
#include "Arduino.h"



#define RF_FREQUENCY                                
433000000 // Hz

#define TX_OUTPUT_POWER                             
5        // dBm

#define LORA_BANDWIDTH                              0         // [0: 125 kHz,
                                                          //  1: 250 kHz,
                                                          //  2: 500 kHz,
                                                          //  3: Reserved]
#define LORA_SPREADING_FACTOR                       7         // [SF7..SF12]
#define LORA_CODINGRATE                             1         // [1: 4/5,
                                                          //  2: 4/6,
                                                          //  3: 4/7,
                                                          //  4: 4/8]
#define LORA_PREAMBLE_LENGTH                        8         // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT                         0         // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON                  false
#define LORA_IQ_INVERSION_ON                        false


#define RX_TIMEOUT_VALUE                            1000
#define BUFFER_SIZE                                 30 // Define the payload size here

char txpacket[BUFFER_SIZE];
char rxpacket[BUFFER_SIZE];

static RadioEvents_t RadioEvents;
void OnTxDone( void );
void OnTxTimeout( void );
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );

typedef enum
{
   LOWPOWER,
   STATE_RX,
   STATE_TX
}States_t;

int16_t txNumber;
States_t state;
bool sleepMode = false;
int16_t Rssi,rxSize;


void setup() {
Serial.begin(115200);
Mcu.begin();
txNumber=0;
Rssi=0;

RadioEvents.TxDone = OnTxDone;
RadioEvents.TxTimeout = OnTxTimeout;
RadioEvents.RxDone = OnRxDone;

 Radio.Init( &RadioEvents );
 Radio.SetChannel( RF_FREQUENCY );
 Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
                               LORA_SPREADING_FACTOR, LORA_CODINGRATE,
                               LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
                               true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );

 Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
                               LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
                               LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
                               0, true, 0, 0, LORA_IQ_INVERSION_ON, true );
   state=STATE_TX;
}



void loop()
{
  switch(state)
  {
    case STATE_TX:
    delay(1000);
    txNumber++;
    sprintf(txpacket,"hello %d, Rssi : %d",txNumber,Rssi);
    Serial.printf("\r\nsending packet \"%s\" , length %d\r\n",txpacket, strlen(txpacket));
    Radio.Send( (uint8_t *)txpacket, strlen(txpacket) );
    state=LOWPOWER;
    break;
case STATE_RX:
  Serial.println("into RX mode");
  Radio.Rx( 0 );
  state=LOWPOWER;
  break;
case LOWPOWER:
  Radio.IrqProcess( );
  break;
default:
  break;
 }
}

void OnTxDone( void )
{
 Serial.print("TX done......");
 state=STATE_RX;
}

void OnTxTimeout( void )
{
  Radio.Sleep( );
  Serial.print("TX Timeout......");
  state=STATE_TX;
}

void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
{
 Rssi=rssi;
 rxSize=size;
 memcpy(rxpacket, payload, size );
 rxpacket[size]='\0';
 Radio.Sleep( );

 Serial.printf("\r\nreceived packet \"%s\" with Rssi %d , length %d\r\n",rxpacket,Rssi,rxSize);
 Serial.println("wait to send next packet");

 state=STATE_TX;
}

@helpmeplease LoRa is a very powerful radio, i.e. uses a lot of power. Your devices are partically screaming at each other, as seen from the RSSI around -40 ~ -50.
If I were to scream one millimeter from your ear, would you understand every single word I’m screaming? Probably not.
Try to move devices 10+ meters apart, with a brick wall or so in between. An RSSI of -80 to -100 is much more acceptable and might improve your results. That’s more normal speaking volume.

Interesting, so a bigger distance is actually more useful? Anyways I will need this to work at a bunch of distances(although it probably wont break i cant restart the board once it is deployed). You got any ideas? I was thinking to just make one board go from rx to tx after around 100ms.
Thanks for the insight though i would have never thought of that.

Are all development boards corresponding to frequency?

Yup, i fixed it when i looked into documentation and found out about
RadioEvents.RxTimeout.Then i just made it skip recieving if it timeouts and just sends messages again, and it works :slight_smile: