This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Program nRF52832, without the development board

I am looking ahead to the time when I will graduate from using the nRF52 development board to building a custom device with the SoC. The PCA10036 chip will obviously not be on our custom board. We will need to program our device. I expect we will include a USB to UART chip to transfer data.

Reading through the nRF52832 specification sheet, it would appear that the UART is routed through GPIO pins. Which ones? There must be a default configuration on boot-up in order to get data into the on-board flash memory.

What is the protocol for programming the flash without the PCA10036 chip? I know how to do it with JLink, but I expect that JLink won't work without the PCA10036.

Last question: is it possible, through carelessness, to assign the UART pins to another function?

  • You can't really use a USB/UART chip to program the module from scratch because there's no code on the nRF52 out of the factory to accept programming over serial. Programming over serial is a facility provided by a bootloader you write and put onto the chip in the first place, which then allows you to write new firmware to the chip.

    So no there is no default configuration on bootup to do anything. A blank chip is a blank chip, it does nothing at all.

    Once you put a bootloader on it however you can choose any pins you like for the UART, the hardware files for the PCA10038 show you which ones are used by that design, but you can use any which are conveniently located on your board.

    To get the initial code on the chip it needs to be programmed through the debug, SWD, interface. So you need to put a header or bed of nails pads on the design, connected to the SWD pins and then use an external programmer, like a JLink or gang programmer or whatever your design/build house uses, to program it.

    Your comment "expect that JLink won't work without the PCA10036" is a bit confusing. The PCA10036 includes an nRF52 chip and a chip which is both a USB/UART and a JLink, the JLink piece is connected on the board to the SWD interface, and externally the USB drives it. That's no different from having an entirely separate JLink connected to the SWD interface, no magic on the PCA10036, just an integrated solution.

    It's possible, through carelessness, to pretty much do anything, including assigning the UART pins to something else, so don't do that.

  • Thanks for your reply, RK. You seem to answer all of my questions! I appreciate it.

    On the nRF52 development board schematic, the interface chip itself is labeled PCA10036. From your description, it appears that PCA10036 would be the part number for the entire board? That's confusing.

    Thanks for informing me about the need to supply a bootloader through the SWD. I think you're saying that GPIO is (at least initially) configured by the bootloader. I will investigate this further.

    And if I understand you correctly -- JLink is always writing to the nRF52 flash through the SWD, and never through the UART. This makes me wonder why my boss has specified a USB to UART chip on our device, when what we really use is USB to SWD. I know we're planning to recharge the battery over USB, but the UART seems redundant.

  • If you're looking at the same schematic I am, there's one sheet labelled 'pca10036 - interface MCU' but that means it's the interface MCU sheet for the PCA10036 board. The schematic is just divided into 5 sheets and they are all labelled PCA10036 - something. The actual chip is an ATSAM32U2CA-AU, because that's one of the chips Segger OB supports.

    On the dev board the flash is always written from the segger via SWD, yes. The UART is on there so you can easily send data to and from the connected PC, it has nothing to do with programming the chip at all.

    You don't need a bootloader at all, it's optional. The softdevice has a small Master Boot Record in it which calls into a bootloader if one exists before starting the main code, that gives you a hook up upgrade the software on the chip (DFU). Whether that uses the UART or BLE or some other method to upgrade is entirely up to you.

  • (annoyed that comments are restricted to 900 characters) .. continuing ...

    usually production boards are initially programmed via a few pads on the board which an external debugger/programmer connects to, you don't need a JLink or equivalent on the board. If you want to make DFU available then serial is a good (and fairly cheap) way to do that, if you don't need to, you don't need it for anything else. Since you have a BLE chip on the board, you can do over the air DFU as well. Since I don't know your boss I have no idea why he specified a UART/USB :). I hope it's clear now that you don't need USB/SWD either, you just need a place an external programmer can attach once to put the initial software on the chip.

  • Hello there, I have a similar question. Is there anyway I can program the chip without the PCA10036? I want to add the nRF52 in one pcb I am designing, but would also want to be able to program it on the go, maybe with an ICSP?

    Thank you!

Related