6
\$\begingroup\$

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

\$\endgroup\$
3
  • \$\begingroup\$ It sounds from the datasheet that is is supported and enabled by default. It might be worth downloading this software nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-Studio and see if it appears to support USB programming. \$\endgroup\$
    – PeterJ
    Jun 3, 2013 at 7:00
  • \$\begingroup\$ Page 135 of pdf 17 = Flash Memory This section describes the operation of the embedded flash memory. The MCU can read and write the memory and perform erase page operations. You can configure and program the flash memory through an external SPI slave interface and you can also configure it to inhibit readback or modification of the memory content. You can also program the flash memory through the USB by using the USB bootloader. It then tells you later that some pages can only be addressed through the SPI interface - doh! \$\endgroup\$ Jun 3, 2013 at 18:38
  • 1
    \$\begingroup\$ Yes - programming via the USB bus can be done via a bootloader. Check the following link. store.diyembedded.com/… Hope this helps Cya. \$\endgroup\$
    – Wez
    Nov 12, 2013 at 4:50

2 Answers 2

3
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

Your laptop does not have an SPI bus. There is a standard protocol for the SPI bus to interface with flash chips, but you need some way to electrically hook up the computer to that bus. I imagine that you could pretty easily build something that would work out of an Arduino Uno, or some cheaper USB Arduino clone, by writing some code that reads the serial port (or USB interface) and writes data to the SPI bus that's built-into the Arduino, and use a separate digital pin to drive the programming pin high.

\$\endgroup\$
2
  • \$\begingroup\$ The chip has a USB bus, that's what I was thinking about. But I can't figure out if I can program it through the USB bus. \$\endgroup\$
    – Anna
    Jun 3, 2013 at 6:42
  • \$\begingroup\$ @Anna You can't do it directly. You need something in the middle which can talk to both the SPI device and the USB on the laptop. An arduino clone is your best bet. \$\endgroup\$
    – Ufoguy
    Jan 26, 2014 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.