I'm trying to send more than 64 bytes over radio using the RFM22 modules. Now my transmitter looks great but for some reason the receivers fails after several successfully receptions.
I was test the transmitter printing all the data every time that the receivers get a valid frame.
I only want to concat this frame in another to get almost 400 bytes packet.
Now my code:
RF22ReliableDatagram rf22(MyNODEID,CHIP_SS,RFM22_INT);
uint8_t buffer[500];
uint16_t buffer_index=0;
uint16_t tiempo_ultimo_rx=millis();
void loop(){
uint8_t buf[RF22_MAX_MESSAGE_LEN+1];
uint8_t len = sizeof(buf);
uint8_t from;
uint8_t to;
uint8_t id;
if (buffer_index >= 400){buffer_index=0;}
if(millis() - tiempo_ultimo_rx >= 200) {buffer_index=0;}
if (rf22.recvfromAckTimeout(buf, &len, 1000, &from, &to, &id)){
for (int i=0; i<len; i++){
buffer[buffer_index+i] = buf[i];
//Serial.write(buf[i]);
tiempo_ultimo_rx=millis();
}
buffer_index = buffer_index +len;
Serial.println(buffer_index,DEC);
}
}
This code only concat all the frames into a local buffer, and after this I will proccess it.
500 bytes like buffer is too much for a ATmega 328?
It's realy strange because it work for several receptions and then fails and stay like this.
If I debug how many bytes I get into the buffer:
Right:
127 (1º first frame)
254 (2º first frame)
342 (3º first frame)
When it fails and stay like this:
127 (1º first frame) loads the firts 127 bytes
127 (2º first frame) do not load nothing
88 (3º first frame) loads the rest
I test others ways but the problem still there..
I-D-E-A-S?? ![]()