While I was exploring online shops for cheap nRF52840 dev boards I can experiment with, I came across this: the Waveshare nRF52840 Bluetooth 5.0 Evaluation Kit.
It is around $25 which is quite a bargain (almost $15 less) compared to the nRF52840DK (the canonical development board when you want to work with the Nordic nRF52840).
I thought it was interesting, because it not only had an Arduino Uno Rev3 compatible pin breakout, it also had a Raspberry Pi compatible breakout.
It also had an interesting jumper system that allows the user to attach any of the onboard peripherals to any of the pins (which means, the user can emulate other dev boards' layouts easily).
Check out the manual: https://www.waveshare.com/w/upload/7/71/NRF52840_Eval_Kit_User_Manual_EN.pdf
It has quite an assortment of onboard peripherals:
- USB to UART chip (CP2102)
- A physical switch between coin cell power or USB power
- Two micro USB ports (one connected to UART, the other connected to native USB, BOTH provide power)
- A TF card slot via SPI
- A buzzer
- A light dependent resistor
- LEDs and a button (and a reset button)
It also had a current testing mechanism by removing a 0-ohm resistor at the back, but alas with my soldering skills I managed to lift those pads Fortunately the tracks were still intact and easy to work with, so I still managed to connect them together and encapsulate them with hot glue to prevent any further mishaps.
The only downside is that it doesn't have a programmer onboard, so you'll need to get one of your own. On the other hand, the jlink edu mini is really cheap. This might actually be an advantage, because the Waveshare board is almost a third of the price of the nRF52840DK even with the added cost of a separate programmer.
Since it had a microusb connected to the native USB pins of the nRF52840 AND it provides power, it's a great candidate for the Adafruit UF2 bootloader (see UF2 and CircuitPython on the Chengdu ebyte nRF52840 for a similar adventure involving a bare chip). But instead of Circuit Python I thought that since it had an Arduino compatible layout, why not try out Arduino? Plus this gives me good practice for trying this procedure out on the PAN1780 eval kit which I'm currently road testing.
Adafruit had done an amazing job at supporting the Arduino framework for the nRF52840 devices. They have made available an Arduino core at https://github.com/adafruit/Adafruit_nRF52_Arduino with very detailed instructions on how to get their boards, as well as a few unsupported boards working with the Arduino IDE.
It so happens that the Nordic nRF52840DK (PCA10056) is included, and that's what I tried out.
The board installation was quite straightforward; the only blocker for someone who is experienced with Arduinos but not with ARM boards is that the installation of the bootloader requires a programmer (as the Waveshare board doesn't have one out of the box, and doesn't include one onboard). There are SWD pins easily accessible and it was a breeze to burn the bootloader afterwards. The instructions at the repo's readme are again, straightforward: https://github.com/adafruit/Adafruit_nRF52_Arduino#burning-new-bootloader
After the bootloader is burned, the board now presents itself as a mass storage device (because of the UF2 bootloader). From this point on, the board acts just like an Arduino board.
Here it is running the Adafruit Neopixel strand test:
There is a caveat though when using Arduino shields: many of the shields will route 5v for their power. While that's fine for most sensors, you need to be careful if there are any potentiometers or any sensors that require reading voltage. The nRF52840 pins are not 5v tolerant and the chip may malfunction if fed more than 3v6 so always check the shield voltages with an actual Arduino first before using it on these types of boards.
Edit: It seems that the Waveshare board already has a bootloader specifically made for it https://github.com/adafruit/Adafruit_nRF52_Bootloader/commit/ddae34c38133cf824a0473fd3ac9ae0566fb863b
I won't be showing the update procedure here, but for anyone who's following you might want to try out this bootloader instead as it supports DFU over serial through the onboard CP2102 USB to UART peripheral.