7 years, 9 months ago.

SX1276 LoRa Continuous mode: how to prevent buffer overflow ?

Hi everybody!

I have SX1276. What I want: 1. set it to receive mode 2. stay on receive mode for given time (say, 750 milliseconds), copiing somewhere all received packets; there may be, for example, 1-10 packets; packet length is 48 bytes, bitrate about 30kbs (bw=500 kHz, SF=6, CR = 4/5, CRC on) 3. when time expires, go to sleep mode

At the moment LoRa is used. I have some legacy code:

	// Start RX
	spi_write_reg( LORARF_REG_01_OP_MODE, LORARF_MODE_RXSINGLE | LORARF_LONG_RANGE_MODE );
	// sET dio0 Interrupt on RxDone
	spi_write_reg( LORARF_REG_40_DIO_MAPPING1, 0x00 );
	// Wait for receiving
	do {
		stat = spi_read_reg( LORARF_REG_12_IRQ_FLAGS );
	} while( !(stat & (LORARF_RX_TIMEOUT | LORARF_PAYLOAD_CRC_ERROR | LORARF_RX_DONE)) );
	// Check result

I have to call this code in cycle. I want to rewrite it for continuos mode. What I read in datasheet : "It is also important to note that the demodulated bytes are written in the data buffer memory in the order received. Meaning, the first byte of a new packet is written just after the last byte of the preceding packet. The RX modem address pointer is never reset as long as this mode is enabled. It is therefore necessary for the companion microcontroller to handle the address pointer to make sure the FIFO data buffer is never full."

How I am supposed to "handle address pointer to make sure FIFO data buffer is never full." ? If I receive 10 packets 48 bytes each, it will be full, so i need to do something to prevent this. Should i, after i copy packet, set RegFifoAddrPtr or RegFifoRxCurrentAddr (or both?) to RegFifoRxBaseAddr ? Will this be enough?

Parent microcontroller is STM32L052K(6-8)Ux

1 Answer

6 years, 9 months ago.

Hi Daria, I just run into the same problem in RX continues mode after time I just receive wrong/old data, very bad. Going after RX() into sleep mode and again into RX() mode overcomes this problem, However I feel that the SX1276 driver or hardware has a problem here.

Regards Helmut