NRF52832: Creating a Project in KEIL uVision.
The other day a development board with an NRF52832 on board arrived from China.

Essentially, the NRF52832 is a microcontroller with an ARM Cortex-M4F core and a 2.4 GHz RF transceiver combined on one die.
The main features and advantages of the nRF52832 chip are listed below
I bought the board to get acquainted with BLE; the radio with a peak consumption of 5.5mA seemed very attractive to me.
The first thing I decided to do when the board arrived was connect it to a programmer and see whether it would detect the chip. Judging by the silkscreen, the board has jtag routed, but the documentation says it is programmed via swd, and the picture below says the same.
A continuity check showed that the pin labeled TMS on the board is actually SWDIO, and TCK is actually SWDCLK. I didn't expect that trick.
Besides the SWDIO and SWDCLK pins, you need to connect VBUS to the programmer and apply power. The supply voltage must be in the range from 1.7V to 3.6V; I took it from a power supply.
Well then, let's check whether the chip is detected in KEIL, but first we need to create a project. I described how to create a project here, so below I'll only describe some subtleties.
Those who have worked with KEIL know that when creating a project you need to specify which chip it will run on. If certain packs aren't installed, you won't be able to find the right chip. So the first thing to do is install the packs highlighted in the screenshot.
Now you can select the NRF52832 when creating a project.

Also don't forget to specify the external crystal frequency.

Now let's create a main file and add the following code to it.
For the project to compile, you need to check the boxes marked in the screenshot.
Now that the chip is connected to the programmer and the project is created, we can check whether the programmer sees the chip. To do this, in the DEBUG tab select the programmer you are using and click OK, and in the tab that opens select the SW interface.
The screenshot shows that the chip has been detected.
We try to flash it and get a programming failed or erase failed error.

That's what happened to me until, in the Flash Download tab, I selected nRF52xxx SoftDevice Erase in the Programming Algorithm field.
After that the board was flashed and the LED started blinking. I bought the board here.
P.S. I usually prefer working with registers, but in this case I needed to check whether the chip would start, so I didn't use them.

Essentially, the NRF52832 is a microcontroller with an ARM Cortex-M4F core and a 2.4 GHz RF transceiver combined on one die.
The main features and advantages of the nRF52832 chip are listed below
- 64MHz ARM® Cortex® -M4F processor core
- 512KB Flash and 64KB RAM
- class-leading computing power (EEMBC 215 CoreMark®) with minimal consumption (90 CoreMark / mA)
- multiprotocol 2.4GHz radio with a peak current of 5.5mA
- -96dBm sensitivity
- +4 dBm output power
- built-in RF Balun
- built-in NFC-A Tag interface supporting features such as Touch-To-Pair and Wakeup-On-Field
- Bluetooth 4.2 specification support
I bought the board to get acquainted with BLE; the radio with a peak consumption of 5.5mA seemed very attractive to me.
The first thing I decided to do when the board arrived was connect it to a programmer and see whether it would detect the chip. Judging by the silkscreen, the board has jtag routed, but the documentation says it is programmed via swd, and the picture below says the same.
A continuity check showed that the pin labeled TMS on the board is actually SWDIO, and TCK is actually SWDCLK. I didn't expect that trick.
Besides the SWDIO and SWDCLK pins, you need to connect VBUS to the programmer and apply power. The supply voltage must be in the range from 1.7V to 3.6V; I took it from a power supply.
Well then, let's check whether the chip is detected in KEIL, but first we need to create a project. I described how to create a project here, so below I'll only describe some subtleties.
Those who have worked with KEIL know that when creating a project you need to specify which chip it will run on. If certain packs aren't installed, you won't be able to find the right chip. So the first thing to do is install the packs highlighted in the screenshot.
Now you can select the NRF52832 when creating a project.

Also don't forget to specify the external crystal frequency.

Now let's create a main file and add the following code to it.
#include <stdlib.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
const uint32_t led_pin1 = 31;
int main(void)
{
nrf_gpio_cfg_output(led_pin1);
nrf_gpio_pin_clear(led_pin1);
while (1)
{
nrf_gpio_pin_toggle(led_pin1);
nrf_delay_ms(1000);
}
}
For the project to compile, you need to check the boxes marked in the screenshot.
Now that the chip is connected to the programmer and the project is created, we can check whether the programmer sees the chip. To do this, in the DEBUG tab select the programmer you are using and click OK, and in the tab that opens select the SW interface.
The screenshot shows that the chip has been detected.
We try to flash it and get a programming failed or erase failed error.

That's what happened to me until, in the Flash Download tab, I selected nRF52xxx SoftDevice Erase in the Programming Algorithm field.
After that the board was flashed and the LED started blinking. I bought the board here.
P.S. I usually prefer working with registers, but in this case I needed to check whether the chip would start, so I didn't use them.




