Avatar for DuncanCragg


Member since Nov 2019 • Last active Mar 2020
  • 1 conversations

Hoping to build on and/or learn from the amazing Espruino software and hardware for my own programming language project. :-)

Most recent activity

  • in Porting to new Devices
    Avatar for DuncanCragg

    Hi @billsalt,

    I'm afraid I ended up using direct wired flashing to the SWD pads rather than the much nicer built-in UF2 system ("dropping a file on a disk"), but I don't know if that would've worked had I not been so impatient! The uf2conv.py tool is needed to convert hex to uf2.

    I had to unlock the chip anyway, I think, with a CMSIS-DAP flasher on the SWD pads. I say "I think" because I do this kind of thing a lot and may have got mixed up with another device :-) I can give you those steps if you like.

    I went with the above config file, modified according to the bit where I said it worked.

    I'm not sure how much you know about all this building/flashing business, to know how to pitch my response! Let me know if I'm talking gobbledegook or baby talk so I know where I am!

  • in Porting to new Devices
    Avatar for DuncanCragg

    We've done it!! I used a mixture of values again, yours and the one from the Nordic dongle:

      'saved_code' : {
        'address' : ((223 - 10) * 4096),
        'page_size' : 4096,
        'pages' : 10,
        'flash_available' : 1024 - ((38 + 8 + 2 + 10)*4)

    Thanks for all that info, not that I really understand what we did or how it worked, mind you!

  • in Porting to new Devices
    Avatar for DuncanCragg

    Oh I didn't see that response; I was typing mine!

    So the numbers still have to be set right even when you SWD it I presume.

    My address and flash_available numbers were just grabbed from elsewhere, not calculated, plus I put a random extra bit on for luck (!), so I could use some help calculating them correctly! :-D

  • in Porting to new Devices
    Avatar for DuncanCragg

    Well I gave up on the uf2 stuff and zapped it via SWD, and now it's properly shagged I think. :-D

    I zapped it with the full Espruino bootloader/SD140/app_hex package.

  • in Porting to new Devices
    Avatar for DuncanCragg

    Wow thanks fanoush, that's all really helpful .. although I don't fully understand all of it! Hopefully I haven't wiped the existing softdevice! Let me try just with the app hex then.. I don't know which SD they're on, but I guess 140.

    make sure the binary and saved_code espruino configuration section fits below 0xF4000

    not sure how I'd ensure that, what do I put in the board config and how do I work that out?

  • in Porting to new Devices
    Avatar for DuncanCragg

    Ah OK, I think I tried that but who knows what state things were in when I did it! I'll try that again..

  • in Porting to new Devices
    Avatar for DuncanCragg

    Hi, just got an Adafruit Clue a couple of weeks ago (first batch I think) and I'm trying to port Espruino to it (obvs).

    But I'm running out of ideas how to get it going - all I want to get running at first is a Bluetooth connection to the web IDE to test that JS works OK, I don't care about pins and peripherals yet.

    Hence here's my super-cut-down board file:

    import pinutils;
    info = {
     'name' : "Adafruit Clue",
     'link' :  [ "https://www.adafruit.com/clue" ],
     'default_console' : "EV_BLUETOOTH",
     'variables' : 2100,
     'bootloader' : 1,
     'binary_name' : 'espruino_%v_cluejs.hex',
     'build' : {
       'optimizeflags' : '-Os',
       'libraries' : [
       'makefile' : [
    chip = {
      'part' : "NRF52840",
      'family' : "NRF52",
      'package' : "QFN48",
      'ram' : 256,
      'flash' : 1024,
      'speed' : 64,
      'usart' : 2,
      'spi' : 3,
      'i2c' : 2,
      'adc' : 1,
      'dac' : 0,
      'saved_code' : {
        'address' : ((270 - 10) * 4096),
        'page_size' : 4096,
        'pages' : 10,
        'flash_available' : 1024 - ((31 + 30 + 2 + 10)*4)
    devices = {
      'BTN1' : { 'pin' : 'D5', 'pinstate' : 'IN_PULLDOWN' },
    board = {
      'left' : [],
      'right' : [],
      '_notes' : {
    board["_css"] = """
    def get_pins():
      pins = [
       { "name":"PD5", "sortingname":"D05", "port":"D", "num":"17", "functions":{}, "csv":{} },
      return pins

    I nicked bits of it from the Nordic dongle suggestions on this forum (I did get the dongle working OK, so the SDK 15 stuff is fine for me). I set the JS code address up a bit in case that needs to be clear of stuff below, but I have to admit I don't know what to put there!

    I build with:

    make clean; rm *hex *.elf

    ..not DFU I don't think, cos they use uf2 for the Clue - so I flash with:

    [..]/uf2/utils/uf2conv.py -f 0xada52840 --convert espruino_2v04.399_cluejs.hex
    cp flash.uf2 /media/duncan/FTHR840BOOT/

    which is getting set into the device OK, but I can't see the Clue Bluetooth device in the IDE.

    Any ideas?