Using Blip with Arduino
- Download and install Arduino IDE (at least v1.6.12) from Arduino website.
- Start the IDE
- Go into preferences
https://gitlab.com/electronutlabs-public/ElectronutLabs-blip/raw/master/package_electronutlabs_boards_index.jsonas an "Additional Board Manager URL"
- Open the Boards Manager from the Tools -> Board menu and search/install "Electronut labs nRF52840 Boards"
- Select 'Electronut labs Blip' from the
Tools -> Board menu
- Select 'Black Magic Probe (GDB)' from the
Tools -> Programmermenu
The main USB port of Blip is connected to the on-board Blackmagicprobe debugger, and to your computer it will show up as two serial ports.
Thw first one of these is the GDB serial port, and is used for programming only. The second one is connected to UART pins of nRF52840 (pins are reconfigurable on the chip).
Any code compiled right now requires Nordic Semiconductor's BLE stack binary, called the Softdevice to be present on the
nRF52840 chip. This needs to be programmed only once while using arduino.
To do this, click on
Tools -> Burn bootloader menu option.
Note about serial ports: In this arduino core,
Serial is the
serial port that comes up when you plug in the secondary USB port of
blip to your computer. This one is USB device peripheral of the nRF52840
Serial1 is the actual UART peripheral of nRF52840 SoC, and it is
connected to the Debugger's serial port (which comes up as the second
serial port on your computer). In Arduino IDE, you have to select the
first port for programming; this means serial montor will not work with
that one. To use serial monitor, you can switch to the second port
Pin mumbers are directly connected to the nRF52840 port/pin numbers. Pin numbers 0-31 are on the chip's Port0. Pin numbers above 32 are on Port1. For example, pin 16 corresponds to Port0, pin 16; pin 40 correseponds to Port1 pin 8 (i.e. 40-32).
You can use the following symbols in your code:
PIN_LED1 pin 13 PIN_LED2 pin 14 PIN_LED3 pin 15 LED_BUILTIN PIN_LED1 LED_CONN PIN_LED2 LED_GREEN PIN_LED1 LED_RED PIN_LED2 LED_BLUE PIN_LED3
PIN_BUTTON pin 38
This serial port is connected to the Black Magic Probe debugger's USB to serial pins.
PIN_SERIAL_RX 8 PIN_SERIAL_TX 6
The SPI pins are connected to the microSD card slot. The pin mapping is as follows:
MISO pin 25 MOSI pin 34 SCK pin 24 SS pin 17
To use another SPI device, second SPI is available to use as
the pin mapping:
MISO pin 26 MOSI pin 23 SCK pin 27
A known issue with blip is that sometimes the debugger is not able to detect the nRF52840 chip when it scans. This happens rarely, and there is a manual fix for that.
Option 1: One can either repeatedly try uploading (which takes time if
compiling), or by trying 'Burn bootloader' (Alt+T, then Up, then enter). If you
arm-none-eabi-gdb directly, you can run it like in the following
terminal capture. First we specify the GDB serial port (which is the first port
detected when Blip is connected to your computer) using
tar ext <GDB port>.
Next, try scanning using the command
mon swdp_scan. Keep on pressing enter
till the chip is detected:
Following is output when chip is not detected:
$ arm-none-eabi-gdb GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q3-update) 184.108.40.20680315-git ... ... >>> tar ext /dev/ttyACM0 Remote debugging using /dev/ttyACM0 >>> mon swdp_scan Target voltage: unknown SW-DP scan failed!
Following is output when it gets detected: ```bash