EEPROM with NRF24LE1
All the good and bad incidents are stored in the brain memory of humans. Similarly, the controller uses EEPROM to save data or variables. In this article, we will see how to use the EEPROM of NRF24LE1 and what are its uses?
Do you know what makes the memory in electronics? Let’s take an example of a capacitor. It has the capability to hold voltage and thus it’s treated as memory component. There are two types of memories in electronics; Volatile and non-volatile. The volatile one gets erased if the power supplied to this memory is cut. That means the data stored will be erased in case of power failure. The non-volatile has an advantage of holding data even when the power is off. The most common example of volatile memory is the RAM used in our computers. The examples of volatile memory are hard disk, SD cards, EEPROM, etc.
In this article, we will focus on EEPROM in our NRF module and its use. EEPROM stands for Electrically Erasable Programmable Read Only Memory. It is a type of Non-Volatile. It can be programmed and erased by providing special programming signals. They are available in small sizes and can be easily interfaced with AVR, Arduino or PIC. Sometimes they are inbuilt in microcontrollers. But for expansion of memory we have to use the external one.
The NRF24LE1, being an amazing component, has inbuilt EEPROM memory. It has 1.5 Kb of Non Volatile data memory. This memory proves useful when we interface sensors and want to retain the readings for future use. For using read and write features of this memory we will use function in our code.
We will use nrfsdk (software development kit) provided by Nordic Semiconductor Ltd.
Please visit our previous article on NRF24LE1 for more help.
Some functions we will be using to read and write EEPROM are:
• lib_eeprom_byte_write() – This function takes address location and a byte data to be written.
• lib_eeprom_bytes_write() – This function take multiple bytes of data along with the number of bytes and starting address.
• lib_eeprom_byte_read() – This function outputs a byte data from the provided memory address.
• ib_eeprom_bytes_read() – This function outputs multiple bytes data from the provided starting memory location
The description of the various functions is:
|lib_eeprom_byte_write()||8-bit address and 8-bit data||-||To write 8-bit data to specified –bit address|
|lib_eeprom_bytes_write()||8-bit address, 8-bit pointer to bytes to write and 8-bit value indicating number of bytes to write||-||To write multiple bytes to specified starting address|
|lib_eeprom_byte_read()||8-bit address||8-bit data||To read 8-bit data from specified 8-bit address|
|lib_eeprom_bytes_read()||8-bit address, 8-bit pointer to bytes to write and 8-bit value indicating number of bytes to read||-||To read multiple bytes from specified starting address.|
For complete understating, please take a look at the implementation of these functions in the code. The code has been commented for greater understanding.
We will write some data to EEPROM memory and then we will restart our system. After that we will read the previously stored data to check the working of the EEPROM.