Blackmagic probe problems with a new nRF51822 device revision

I know quiet a few readers of the blog are interested in the nRF51822, and use either the Blackmagic probe or OpenOCD to program your devices.

So I thought it worthwhile to share my experiences today, when I was unable to program a nRF51822QFAA device

 

To cut to the chase, the device identification in full is the nRF51822QFAAH1.  This appears to be a new revision of the QFAA device (16k RAM 256k flash), which neither the Blackmagic probe or OpenOCD support, as its CONFIG ID code seems to be 0x008F where as the QFAAH0 is 0x0072

I will endeavor to update my Blackmagic probe repo as soon as I have confirmation via the Nordic developers forum that this indeed the case.

I’ve also logged a issue on the master Blackmagic probe repo, and will bring this to the attention of the OpenOCD team if confirmed.

 

In reality, the problem of not being able to program a specific board, has taken a while to quantify, as I had a batch of 40 boards to flash with custom firmware, and the first board I tried seemed to have this issue, so I ended up using a Jlink to flash the boards (which had its own issues, but thats another story).

Anyway, of the 40 brand new boards I received from a Chinese manufacturer, only 1 seems to contain this new device, so it was sod’s law that it was the first board that I attempted to program.

And doubly confusing, as I presumed the whole batch had the new device, so I didnt take note of which board would not initially program, So ended up having to retest all 40 again to find it, and confirm that all the other boards contained the QFAAH0 version.

But thats the way the cookie crumbles some days.

19 Responses

  1. Roger Clark
    |

    I’d not seem that product.

    Its hard to tell precisely what it is. The taobao page seems to indicate its a jlink compatible programmer for nRF51822, and mentions nRFGo.
    The AliExpress listing says “Support online SWD programming” but I’m not sure if they mean OTA or not.

    Its only got one processor on it, and that processor looks more like a STM32 than a nRF51.

    I wonder if its something like a STLink that has been updated to hold JLink firmware . I think there is an official method to replace the STLink firmware with JLink firmware (and go back to STLink again if necessary), but I’ve not tried this myself on any boards.
    So its not impossible that the manufacturer could flash this device with STLink then do the upgrade to Jlink and then sell it as a JLInk device.
    (As an unofficial STLink binary is kicking around on the Internet, which could be used to initially flash onto the device, hence allowing Jlink to be installed. Or they could have figured out how to directly get JLink onto a STM32)

    Its really hard to know.

  2. Manish Kathuria
    |

    Here is another board that looks similar to the one above and suggests it’s based on FTDI chip (Search for SWD_USB on this page). Similar claim “Used for our Nordic nRF51 Bluetooth 4.0 and other custom protocol based development”

    http://www.pikron.com/pages/products/accessories.html

    Bit-banging??? May be.

    Just out of curiosity – the board with latest chip on it, was it OTA capable when you received it? If so, are chip identification checks performed while OTA programming? If not then isn’t it better to always do OTA application uploading?

  3. Roger Clark
    |

    The board with the latest chip on it (QFAAH1) was just an iBeacon.
    I reflashed it with some custom beacon firmware for a client (after I’d updated the Blackmagic probe to recognise the device).

    At the moment the only way I have to do OTA is using my phone, but it would be great if there was a dongle method to do the same thing.
    I think the Nordic dongle can be used to do OTA, but its $99.

    In theory it may be possible to use VUSB with the nRF51822 so that no other devices are needed to OTA, but it would be a lot of work.
    It may be easier to write a driver for a different off the shelf BLE usb dongle.
    Some normal USB Bluetooth dongles claim to have BLE support, and I found this about scanning for iBeacons on a RPi
    http://stackoverflow.com/questions/21733228/can-raspberrypi-with-ble-dongle-detect-ibeacons

    which implies that the BLE functionality must be availble. But precisely how much control is available from RPi is unclear.

    BTW. I did post a question to the Nordic developer forum to ask if they had opensourced the “master” side of the OTA upload – but they said that they had not and didnt have any plans to release that source code.

    So to do OTA from an NRF51 you’d need to write the DFU code from scratch 🙁

    Re: The FTDI device
    I may operating with code as discussed on this page

    https://www.reddit.com/r/AskElectronics/comments/22cwl0/arm_cortex_m_swd_over_ftdi_usb_to_serial_chip/

    All of these options sound quite complicated by comparison with the BMP

  4. paul
    |

    Hi Roger,
    i hope you can help me.. But first i have to apologize for my bad english. So i started the hole nrf thing a few days ago i bought an mapel mini clone form ebay (alice…) and in linux i was able to flash your bmp firmeware on to the mapel. After that i tried to plug it in via its USB port and on Linux i got 4 new USB ACM devices, on Windows 10 i only see one device called:”Black Magic Firmeware upgrade (STM32F103c8)”.

    so i got back to my linux machine and wanted to include your RBL_nRF51822 arduino files into my hardware folder, i did include them in both the sketchbook folder and the arduino home folder. But the ide does not show me the board in the boardmanager( i got the board on my win. 10 pc installed).

    So can you or maybe some one reading this help me to get one of these 2 problems solved.
    Thank you and have a great day, Paul!

    Ps: keep up the cool work!

  5. Roger Clark
    |

    Paul

    There are new signed Windows 10 drivers, for the BlackMagic Probe, but I have not had time to copy them into my repo, as they are very new (8 days ago)

    There is a pull request into the master BMP repo, which is pending, https://github.com/blacksphere/blackmagic/pull/157

    So you will need to get the files from the author of the new files

    https://github.com/clovett/blackmagic/tree/master/driver

    Note. I have renamed my Blackmagic probe repo, to https://github.com/rogerclarkmelbourne/blackmagic_archive_version as I needed to send some fixes to the official blackspere master repo, and the only way to do that was to have a direct fork (unmodified)

    My plan is to update my new copy of https://github.com/rogerclarkmelbourne/blackmagic (which is a direct unmodified fork), to add the Maple Mini etc again.
    However the STM32 files in the blacksphere (master) repo have changed and I’m not simple able to copy my Maple Mini files into the repo, as they don’t compile 🙁

    So for the moment, please continue to use my renamed repo, and I will post to my blog when the new repo is fully working

    Unfortunately at the moment I have a lot of commercial work, and do not have much time to update the repo’s

  6. paul
    |

    I like to hear that :)!

    i am now a point where i can use the bmp with the gdb under Linux and find the nRF when i was scanning, but i am not able to upload a new softdevice..
    Right now i am i am also trying to conmpile a sketch in the arduino ide under linux, but i am getting some errors, when i find a good way and everything works out under Linux i will write a comment on how i did everything!

    cheers Paul

  7. Roger Clark
    |

    I did a video on SD installation.

    Its on Windows but its the same on Linux, as its all command line GDB

  8. Paul
    |

    Hi Roger, its me again!

    I got it to work! i was able to do the bmp stuff in Linux and did even flash the softdevice in Linux! And i did just uploaded a blinksketch on Windons to the nRF without even having the drivers installed! so that seems to work quite well i will try out some ble stuff now!

    Thanks for your great Work and Help!
    cheers Paul,

  9. Roger Clark
    |

    Hi Paul

    Using the BMP on Linux is very similar to on Windows, I’m not using an external scripts (external to the Arduino IDE), I’m just calling GDB directly and in both cases GDB is installed by the Arduino IDE

    BLE stuff should work, (works fine for me on Windows)

  10. Paul
    |

    hi Roger,
    i had a nother problem, my upload seems not to work anymore.. or did to even worked i dont know,

    The console tells me this :

    Target voltage: Not Implemented!
    Available Targets:
    No. Att Driver
    1 Nordic nRF51 0x0072

    and says that the Upload has finished but the Led does not blink.
    Do you have an idea what i could try to fix that ?

  11. Roger Clark
    |

    Which LED is not blinking

    Why did you expect it to blink, did you load a blink sketch
    Did you load the S130 V1.0 (SDK 10) soft device
    Is the LED on your board connected to the pin you assigned in your sketch
    Have you checked the pin mapping
    etc
    etc
    etc

  12. Paul
    |

    I, die load The softdevice and i folllowed your Instruktions my LED is on Pin 0.15 as you described in your Post.
    I did Load the Blink Sketch.

  13. Paul
    |

    Hi Roger, quick updated:
    i am able to upload a blink sketch to nRF by using your old Repo(nRF51822-Arduino-S130) and the bootloader.hex as a softdevice, but when i try to use your new Repo (https://github.com/rogerclarkmelbourne/Arduino_nrf51822) and the s130 softdevide i get an error while compiling, i will try to figure that out or see your response to Maggi in the YT-comments.

    cheers Paul.

  14. Roger Clark
    |

    Old repo uses S130 SD 1.0 (SDK10)

    New repo is a fork of Sandeep Mistry’s repo, which uses SDK 11 (or perhaps SDK12) and uses S130 SD 2.0.x

    Try reflashing with SD2.0.1 when using the new repo.

    Additionally, you could also try using Sandeeps repo direct. I only forked it to add some extra boards and support for JLink and BMP that Sandeep won’t support as he only wants to upload using OpenOCD

  15. Roger Clark
    |

    The Uno is a lot different from the nRF51, because the Uno uses the old 8 but AVR processor but the nRF51 and most modern CPU’s are based on the ARM CPU core (M0 class on the nRF51).

    But the amount you need to change your code depends on whether you used AVR hardware directly and whether you used external libraries that may only work with 8 bit processors.

    The best way is just to try running your code and see if it compiles and after that if it runs.

    BTW
    I now recommend that everyone uses Sandeep Mistry’s Arduino core, not the old RedBearLabs ones that I used last year.

    See https://github.com/sandeepmistry/arduino-nRF5

  16. Paul
    |

    Hi Roger,

    Have you updated the blackmagic probe repo for the nRF51822QFAAH1? I’m looking to use your methods with the blackmagic probe to program a board which has this chip on it.

    Thanks,
    Paul

  17. Roger Clark
    |

    I don’t think I pushed the update for this back to github…

    I noticed the issue with the H1 a while ago, and I think I must have updated one of my local BMP repo’s and recompiled.

    I also submitted a PR for this to the master BMP repo (Blacksphere), which I think they incorporated.

    But because Blacksphere radically refactored their source a few months ago, and my “platform” code no longer works with the official version.

    So I have ended up with an orphaned repo (well 2 of them), which are now getting out of date, but which I don’t have time to update.

    I was hoping just to submit my platform code for the generic STM32 and the Maple mini, and also a Baite STLink dongle to Blacksphere, but I simply don’t have time at the moment to undertake all that work.

    Your best course of action, is probably to look at the code thats in the official Blacksphere BMP repo and copy the new code into your sources and recompile

  18. Roger Clark
    |

    Excellent!

Leave a Reply