# MakeCode for nRF52840?

**URL:** <https://forum.makecode.com/t/makecode-for-nrf52840/1164>\
**Category:** Maker\
**Created:** [February 5, 2020, 10:58pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164 "2020-02-05T22:58:34Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [July 17, 2020, 7:17am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/21 "2020-07-17T07:17:03Z")

</div>

There is currently no hardware available, other than hacking something with a bread board. When there is some hardware we can add it.

You can use this bootloader [https://github.com/adafruit/Adafruit\_nRF52\_Bootloader/blob/master/src/boards/arcade\_feather\_nrf52840\_express/pinconfig.c](https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/src/boards/arcade_feather_nrf52840_express/pinconfig.c) with a hacked Feather 840. Otherwise, you can build your own.

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 17, 2020, 10:34pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/22 "2020-07-17T22:34:17Z")

</div>

I have a 840 board designed and my pull request for CircuitPython support was just merged. So, it will support CP officially. [https://tinkeringtech.com/blog/scoutmakes-azul/](https://tinkeringtech.com/blog/scoutmakes-azul/) I can design some HW around this platform.

In the pinconfig.c that you referenced above has pons for Left, right, up, down, etc.  
In order to test, do I just wire up the same as here [https://learn.adafruit.com/makecode-arcade-with-samd51-m4/feather-m4-express](https://learn.adafruit.com/makecode-arcade-with-samd51-m4/feather-m4-express) ?

Do I need to build the .uf2 bootlader for the URL you referenced?

Thanks.

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 18, 2020, 3:02am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/23 "2020-07-18T03:02:44Z")

</div>

I tried to build the840 express .uf2 got the below error. Any ideas?  
I cloned [https://github.com/adafruit/Adafruit\_nRF52\_Bootloader/](https://github.com/adafruit/Adafruit_nRF52_Bootloader/)

_$make BOARD=arcade\_feather\_nrf52840\_express all_

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/48ae41149dde83149885e212abd3864dc6bb1a51.jpeg)

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [July 20, 2020, 11:39am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/24 "2020-07-20T11:39:54Z")

</div>

Adafruit folks provide binary builds on their github. You can use that.

You need to wire it the way it’s described in pinconfig.c, not sure if it’s the same as the M4 guide.

As for build failure, you need to do git clone --recursive at the beginning.

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 21, 2020, 2:16am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/25 "2020-07-21T02:16:17Z")

</div>

I managed to get it to build after your suggestion of --recursive during the clone. thank you for that.

However, I tried to flash my board by dragging over the .uf2 to the device via USB, but nothing seems to happen with the flashing of the new bootloader. Something I’m missing?  
Does this new .uf2 have code to unlock, flash and relock the bootloader space?

I will test the breadboard wiring once I can successfully flash the 840 with the makecode arcade bootloader.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/46fee74561b35000818521ae5f3d06fbfe59d7cf.jpeg)

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [July 21, 2020, 7:39am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/26 "2020-07-21T07:39:36Z")

</div>

You can follow instructions here [https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/update-bootloader](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/update-bootloader)

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 21, 2020, 1:42pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/27 "2020-07-21T13:42:38Z")

</div>

ok @mmoskal . Was able to follow those instructions and got the makecade arcade .uf2 flashed on the 840.

I downloaded the jumpy platformer game from makecode beta for N4 and tried to drag over the game to the 840 while in bootloader mode, but was getting the same error @204maker reported above [MakeCode for nRF52840?](https://forum.makecode.com/t/makecode-for-nrf52840/1164/19) any thoughts on resolving this issue. Appreciate all your responses so far.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/f3bb093fdd392bd873d7585c5e87c2b04b3d639c.png)

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [July 21, 2020, 2:28pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/28 "2020-07-21T14:28:47Z")

</div>

It could be the drive is unmounting itself too quickly. You should check - it may still work.

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 21, 2020, 3:12pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/29 "2020-07-21T15:12:42Z")

</div>

@mmoskal you are correct. Despite the error, the game runs.  
The buttons don’t seem to work right still, but might be a breadboarding issue, so I will need to check.

How do we fix the file load error? Also, I’m working on hardware to support makecode arcade on the 840. How can we get the 840 platform out of experiment to supported?

I’m not a SW dev, but willing to help in any way I can.

For anyone else looking for the wiring the OLED to the 840 express, here’s the map from pinconfig.c

_4, 0x18, // PIN\_BTN\_A = PIN\_RX_  
_5, 0xa, // PIN\_BTN\_B = PIN\_D2_  
_47, 0x6, // PIN\_BTN\_LEFT = PIN\_D11_  
_48, 0x1a, // PIN\_BTN\_RIGHT = PIN\_D9_  
_49, 0x1b, // PIN\_BTN\_UP = PIN\_D10_  
_50, 0x7, // PIN\_BTN\_DOWN = PIN\_D6_  
_51, 0x8, // PIN\_BTN\_MENU = PIN\_D12_

_32, 0xe, // PIN\_DISPLAY\_SCK = PIN\_SCK_  
_34, 0xd, // PIN\_DISPLAY\_MOSI = PIN\_MOSI_  
_35, 0x1e, // PIN\_DISPLAY\_CS = PIN\_A2_  
_36, 0x1c, // PIN\_DISPLAY\_DC = PIN\_A3_  
_43, 0x2, // PIN\_DISPLAY\_RST = PIN\_A4_  
_44, 0x3, // PIN\_DISPLAY\_BL = PIN\_A5_

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/3eb83cd20005b297cc70e51376494048643dc66a.jpeg)

---

<div class="post-metadata">

**Author:** ![TinkeringTech](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@TinkeringTech](https://forum.makecode.com/u/TinkeringTech)\
**Post date:** [July 23, 2020, 1:43pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/30 "2020-07-23T13:43:31Z")

</div>

@mmoskal any thoughts on the above or where I could get some assistance? Thanks for all your help this far.

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [July 23, 2020, 2:01pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/31 "2020-07-23T14:01:05Z")

</div>

You can report the uf2 error at [https://github.com/adafruit/Adafruit\_nRF52\_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader)

---

<div class="post-metadata">

**Author:** ![204maker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/204maker/32/447_2.png) [@204maker](https://forum.makecode.com/u/204maker)\
**Post date:** [November 18, 2020, 6:30am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/32 "2020-11-18T06:30:49Z")

</div>

I’m back to trying nRF52840. I have a new nRF52840 Feather Express.  
 ![FTHR840BOOT](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/b03acdd9ba3f7f76ab0256a48f21945bf93e603a.png)

**I was trying up update the existing bootloader with an ‘arcade bootloader’ for this board from Adafruit:**

> **[Release 0.3.2 - 2020.03.12 · adafruit/Adafruit\_nRF52\_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/tag/0.3.2)**
>
> Make sure all pins are in reset state when jumping to app mode.

> **[GitHub - adafruit/Adafruit\_nRF52\_Bootloader: USB-enabled bootloaders for the...](https://github.com/adafruit/Adafruit_nRF52_Bootloader)**
>
> USB-enabled bootloaders for the nRF52 BLE SoC chips - GitHub - adafruit/Adafruit\_nRF52\_Bootloader: USB-enabled bootloaders for the nRF52 BLE SoC chips

> Making your own UF2

To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000

To create a UF2 image from a .bin file:

```auto
uf2conv.py firmware.bin -c -b 0x26000 -f 0xADA52840

```

To create a UF2 image from a .hex file:

```auto
uf2conv.py firmware.hex -c -f 0xADA52840

```

To create a UF2 image for bootloader from a .hex file using separated family of **0xd663823c**

```auto
uf2conv.py bootloader.hex -c -f 0xd663823c

```

**I am currently using Windows 10 trying to flash an arcade bootloader to the nRF52840 Feather express board.**

**Method 1:**  
I tried to drag and drop the converted .UF2 file to the FTHR840BOOT (E:) but it does not change anything on the bootloader. I tried renaming the .UF2 file to CURRENT.UF2 and overwrite the existing file but it does nothing on after reset.  
 ![FTHR840BOOT](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/b03acdd9ba3f7f76ab0256a48f21945bf93e603a.png)

What did I miss here?

**Method 2:**  
To flash the bootloader with JLink:  
` make BOARD=arcade_feather_nrf52840_express flash `

**Using J-flash Lite with the SEGGER J-Link EDU with the hex file failed too.**  
 ![J-flash lite for nrf52840](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/982859620d8b9adc4b9a90d238b902b5bad80572.png)

How were you able to successfully update the bootloader to use the arcade bootloader version?

---

<div class="post-metadata">

**Author:** ![mmoskal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmoskal/32/20_2.png) [@mmoskal](https://forum.makecode.com/u/mmoskal)\
**Post date:** [November 18, 2020, 9:11am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/33 "2020-11-18T09:11:51Z")

</div>

The NRF52 bootloader currently can’t update itself with a UF2 file (unlike the STM32 and SAMD bootloaders), so there’s no need to convert the bootloader to UF2. You can use the Adafruit instructions as posted above:

> **[Introducing the Adafruit nRF52840 Feather](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/update-bootloader)**
>
> The Adafruit Feather nRF52840 Express is the new Feather family member with Bluetooth Low Energy and native USB support featuring the nRF52840! It's our take on an 'all-in-one' Arduino-compatible + Bluetooth Low Energy with built in USB plus battery...

---

<div class="post-metadata">

**Author:** ![204maker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/204maker/32/447_2.png) [@204maker](https://forum.makecode.com/u/204maker)\
**Post date:** [November 18, 2020, 1:14pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/34 "2020-11-18T13:14:15Z")

</div>

**On Windows** , download `adafruit-nrfutil.exe` from this link:  
[https://github.com/adafruit/Adafruit\_nRF52\_nrfutil/releases/tag/0.5.3.post13](https://github.com/adafruit/Adafruit_nRF52_nrfutil/releases/tag/0.5.3.post13)

However, the link does not contain adafruit-nrfutil.exe. I am using Windows 10 64-bit. Would you know where to find a working adafruit-nrfutil.exe for Windows?

---

<div class="post-metadata">

**Author:** ![204maker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/204maker/32/447_2.png) [@204maker](https://forum.makecode.com/u/204maker)\
**Post date:** [November 19, 2020, 12:07am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/35 "2020-11-19T00:07:50Z")

</div>

@TinkeringTech, how did you flash the Makecode Arcade UF2 bootloader to the nRF52840?

---

<div class="post-metadata">

**Author:** ![204maker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/204maker/32/447_2.png) [@204maker](https://forum.makecode.com/u/204maker)\
**Post date:** [November 22, 2020, 6:04am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/36 "2020-11-22T06:04:50Z")

</div>

I tried to flash the bootloader today from compiling the source on Ubuntu 16.04 LTS.

> arcade\_feather\_nrf52840\_express\_bootloader-0.3.2-184-g64ea299-dirty\_s140\_6.1.1.zip

However, I got an error uploading a UF2 game into my arcade.  
 ![UF2 game error](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/01de84976e1175d0bfad815ecca38d7b60ff8b49.png)

What does ‘dirty’ mean?

Only the downloaded bootloader from Adafruit’s release worked.

> [https://github.com/adafruit/Adafruit\_nRF52\_Bootloader/releases](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases)

[arcade\_feather\_nrf52840\_express\_bootloader-0.3.2\_s140\_6.1.1.zip](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.3.2/arcade_feather_nrf52840_express_bootloader-0.3.2_s140_6.1.1.zip)

---

<div class="post-metadata">

**Author:** ![204maker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/204maker/32/447_2.png) [@204maker](https://forum.makecode.com/u/204maker)\
**Post date:** [November 22, 2020, 6:48am UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/37 "2020-11-22T06:48:39Z")

</div>

Also, I tried to re-assign the pins form the source (pinconfig.c), recompiled then flashed the ‘dirty’ bootloader to the nRF840 Feather Express board successfully. When I tried to check the contents of the UF2 file using the patcher, I noticed that the contents of the CURRENT.UF2 file remains unchanged on the ARCADE-N4 drive.

---

<div class="post-metadata">

**Author:** ![tcpipchip](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@tcpipchip](https://forum.makecode.com/u/tcpipchip)\
**Post date:** [May 23, 2022, 4:46pm UTC](https://forum.makecode.com/t/makecode-for-nrf52840/1164/38 "2022-05-23T16:46:07Z")

</div>

No BLE extension ?

[Previous page](https://forum.makecode.com/t/makecode-for-nrf52840/1164.md?page=1)
