Analyzing the SX1276 FIFO implementation

2018-06-22 06:08:20

I've been through the HopeRF95W datasheet a couple of times; some parts less and some parts more.

The Payload Data Extraction from FIFO on page 36 is really very clear and concise.

Once the FifoPtrAddr is set to the end the written segment on the buffer (using FifoRxCurrentAddr), we check the number of bytes (NB) received, loop through that number and read the RegFifo; which is an 8bit register, that NB of bytes times.

This github implementation follow this as well:

uint8_t currentAddr = ReadRegister(REG_FIFO_RX_CURRENT_ADDR);

uint8_t receivedCount = ReadRegister(REG_RX_NB_BYTES);

*p_length = receivedCount;

WriteRegister(REG_FIFO_ADDR_PTR, currentAddr);

for(int i = 0; i < receivedCount; i++) {

payload[i] = ReadRegister(REG_FIFO);

}

All clear and easy to understand. I am only curious how the SX1276 knows to load the next 8 bits of the FIFO into the RegFifo by simply looping through it?

Is it one of those things where a read triggers some internal event/mechan

  • At the lowest levels of the FIFO implementation, there is an address (pointer value) and a write enable and read enable. I am assuming, without seeing it, the function ReadRegister() knows how many were written, and increments the address pointer each time it reads.

    As far as typical FIFO implementations, in the simplest form it is nothing more than "write some data incrementing the write pointer each time; and, then, read data to a maximum of read pointer = write pointer" (pointer = address). Could be implemented as a circular buffer, could be "reset pointers to 0" before next data is written, but, in the end, as a user, it should behave the "same" and be independent of the device. Data sheet/user's guide should tell you about any details related to using it.

    They are also used in HW design (i.e. SW doesn't have access to it) for other things such as elastic buffers... e.g. accept a burst of data that arrives faster than it can be processed and/or transmitted. These are sized

    2018-06-22 06:30:51