Electronic – How to program the nRF24LU1+

microcontrollerprogrammer

I'm going to buy a nRF24LU1+, which is an RF system with a built-in microcontroller. How do I find out what kind of hardware I need to program this specific chip?

The FAQ says:

By pulling the PROG-pin high, the internal flash will be available on the SPI pins. It can be then be programmed as a standard SPI flash device, using any programmer that supports this.

Does this mean that I can program it completely from my laptop using only software?

It seems as though it can be programmed via USB, but I can't figure that out from the product specification.

Supports firmware upgrade over USB

Best Answer

A fully erased chip would require some kind of programmer driving the SPI lines. This could potentially be a very simple piece of hardware, assuming you had the matching software to do the programming.

When they say:

Supports firmware upgrade over USB

This is because the firmware itself is capable of erasing and writing the flash. That means you can program the chip with a bootloader and then talk to that bootloader via whatever interfaces it supports (in this case, USB). This is extremely common for modern microcontrollers.

The product brief says that it comes pre-programmed with the USB bootloader, so as long as you don't erase it you can program your application via USB:

17.4 Flash programming through USB

The nRF24LU1 bootloader allows you to program the nRF24LU1 through the USB interface. The bootloader is pre-programmed into the nRF24LU1 flash memory and automatically starts when power is applied. After start-up the bootloader copies the flash programming code to the internal SRAM from where the complete flash memory can be programmed.

The bootloader occupies the topmost 2K bytes (KB) of the flash and is not deleted unless the user program extends into this area. If the program is larger than 14KB the bootloader is overwritten and lost. In addition to the topmost 2 KB of the flash, the bootloader also uses the 3 byte reset vector at address 0.

If your application needs to re-execute the bootloader; you must restore the reset vector so that the bootloader executes after power on reset.

So you can see you must take some care not to overwrite the bootloader and you must provide some way to get back into it from your application (for example, by checking that a particular pin is low because a "prog" button is being held down when it powers on). If you break the bootloader you have "bricked" the chip until you fix it with a SPI programmer.