nRF52832-based implementations - using mbed compiler

09 Jun 2017

I am working on a project that will use the nRF52832 SoC. Some initial work can be done with the nRF52-DK which is supported by the mbed compilation system.

The next stage will involve a PCB with the specific peripherals needed for the project. Is there any documentation on how to design this so it will work with the same compiler. Broadly, I was thinking to provide an MK20-like interface for drag and drop program load and serial monitor. Would that be sufficient? Could we then use the nrf52-DK platform within the compiler without having to create another mbed platform.

Thx.

10 Jun 2017

I am familiar with ST parts and ecosystem and have built two custom boards that run mbed. I don't know what the MK20 interface is or what debugger one might use with Nordic parts. But I can tell you what I did with the ST parts. The mbed compiler provides a binary that runs on the bare metal the same as any other compiler. Once you have that binary you can use any standard method for loading it onto the target. I use eclipse/sw4stm32 and can program the target directly from the IDE. Or I can use STlink utility to flash a binary to the target through STlink. Or I can take a nucleo board and use that as the debugger/programmer and drag and drop the .bin to an external target.

To setup the micro, start with power and ground pins and bypass caps per usual. The ST parts have a Boot pin that needs to be tied low as well. Nordic should have instructions on a minimum configuration to get the micro running. For the oscillator, mbed startup first checks for an external clock, then an external crystal, then rolls over to the internal oscillator. If you don't have anything that needs precise timing, internal may be fine in which case you don't have to do anything. If you have USB or something that needs a crystal, mbed is set to expect a specific crystal. It's probably 8MHz, but I forget if that is for all boards or only the one I was working on.

For programming, I don't put the mbed interface IC on my target board. My board is connected to the programmer and debug uart the same way any standard STM32 board would be. There aren't really any special provisions because it's mbed. For debugging I use the SWD connection and STLinkV2 so I connect the SWDIO,SWCLK, NRST and SWO (swo is optional) to a 20pin jtag header which goes to the STLink V2.

The mbed stdio printf stuff goes out a specific uart. You will have to figure out what the default uart is for your micro. I run that uart tx,rx plus ground to a header on my production board. This is then my debug message port and I use an FTDI usb to 3.3V serial cable to view those debug messages on my computer. This is in place of the mbed interface IC on the development boards which does the uart to usb conversion for you.

You may want to work with full source files mbed-dev or mbed-os so you can see all the behind the scenes stuff.