element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs UF2 and CircuitPython on the Chengdu ebyte nRF52840
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: parasquid
  • Date Created: 11 Sep 2020 3:34 PM Date Created
  • Views 1863 views
  • Likes 0 likes
  • Comments 2 comments
  • hack
  • uf2
  • circuitpython
  • diy
  • nrf52840
  • play
Related
Recommended

UF2 and CircuitPython on the Chengdu ebyte nRF52840

parasquid
parasquid
11 Sep 2020

The nRF52840 by Nordic is an Arm M4 chip with 1MB of flash and 256KB of ram, and has native USB capabilities. This makes it very convenient to run Circuit Python.

 

Circuit Python however, uses a bootloader called UF2 which Adafruit had adapted for the nRF chips: https://github.com/adafruit/Adafruit_nRF52_Bootloader

 

I decided to make a small shield with some necessary components on it, so I can just snap it on top of the prototype dev board I had and I don't have to make anything permanent.

 

image

  • On the left side is a female header that connects the USB VBUS, D-, D+ and GND to the nRF52840 directly.
  • There's also the red wire to connect VBUS to VDDH.
  • A 10k resistor pulls up the reset pin through VDD
  • A momentary switch is connected to the reset pin, which then is shorted to ground via a 1k resistor when pushed

 

image

 

I then downloaded the pre-built hex binary from https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/tag/0.3.2 (I used the pca10056_bootloader-0.3.2_s140_6.1.1.hex) and flashed it via SWD

 

PS C:\Users\tristan\Downloads> openocd -d2 -f interface/jlink.cfg -c "transport select swd" -f target/nrf52.cfg -c "init; halt; flash erase_check 0; program pca10056_bootloader-0.3.2_s140_6.1.1.hex; reset; exit"
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

swd
Info : J-Link ARM-OB STM32 compiled Jun 30 2009 11:14:15
Info : Hardware version: 7.00
Info : VTarget = 3.300 V
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : nRF52840-xxAA(build code: D0) 1024kB Flash, 256kB RAM
Warn : Flash protection of this nRF device is not supported
Error: nrf52.cpu -- clearing lockup after double fault
Running slow fallback erase check - add working memory
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Info : Padding image section 0 at 0x00000b00 with 1280 bytes
Info : Flash write discontinued at 0x00025de8, next section at 0x000f4000
Warn : Adding extra erase range, 0x00025de8 .. 0x00025fff
Warn : Adding extra erase range, 0x000fb620 .. 0x000fbfff
Warn : Adding extra erase range, 0x10001000 .. 0x10001013
Warn : Adding extra erase range, 0x1000101c .. 0x10001fff
** Programming Finished **
P

 

Attaching a USB cable will then present the UF2 bootloader as a disk drive with the label NRF52BOOT

 

image

 

I then downloaded a pre-built Circuit Python firmware from https://circuitpython.org/downloads  but the question is: which one? Since this is a bare chip and I don't have any peripherals, I browsed through the available boards and looked for one that had the minimal configuration. I ended up with the SparkFun Pro nRF52840 Mini https://circuitpython.org/board/sparkfun_nrf52840_mini/ and the pin definitions at https://github.com/adafruit/circuitpython/blob/main/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c

 

Dragging the uf2 file onto the bootloader reboots the chip and then presents it as a disk drive with the label CIRCUITPY

 

image

 

Editing code.py and then saving it with a small blink sketch works as expected. I had to refer to https://github.com/adafruit/circuitpython/blob/main/ports/nrf/boards/sparkfun_nrf52840_mini/pins.c  for the pin definitions as SparkFun didn't use the matching pin numbers for the silkscreen.

 

image

 

Next up: I try out Mbed OS and make a custom target definitionARM Mbed OS on a Bare nRF52840 Chengdu Ebyte Custom Target

  • Sign in to reply
  • parasquid
    parasquid over 4 years ago in reply to DAB

    Thanks! I try all my "dangerous" experiments with this one since it's really cheap and easily replaceable image After figuring things out, that's when I try it with a more expensive dev board to confirm image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice update.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube