How to Flash NRF51 on Gateway Shield


#1

Hello

Can’t seem to find info on the following …

I have a Gateway Shield and I would like to flash modified firmware (for testing/debugging) to the BLE module.

I can see that we are using JTAG/SWD for the task. But what programmer hardware, software (I’m running OS X, mainly) and so on?

Currently, I only have an ST-Link/V2 JTAG and STM8 programmer, which I have used for bare metal programming of the original SparkCore. I haven’t looked at requirements for the Photon yet. There be dragons there, though! I had to downgrade the ST-Link’s firmware to work with the then available versions of OpenOCD.

So in short – what are you good fellows using? What is your physical development and debugging set-up? I’d like to mirror that same set-up, as precisely and practically as I can.

Many thanks!

Now to go find where I can get a 1.27mm header socket – not to mention ribbon cable that will fit onto same. I would welcome hints there, too.

Gruvin


#2

The easiest way to load firmware built locally is Over the Air. You can see more details here: http://docs.bluz.io/tutorials/updates/#loading-firmware

Basically, you use the Particle CLI to flash new binary files. When you build the firmware from our repository, those binary files are created. It is the longer method, it can take up to a minute when flashing system firmware, but it is the simplest.

The second way would be to use bootloader setup. This requires a 3V3 USB to Serial converter which you can then use to flash firmware directly. You need to enter bootloader setup mode, which can be done on the gateway shield by holding pin D6 to GND for 5-6 seconds upon boot up. You can read more about this here: http://docs.bluz.io/tutorials/bootloader/

Finally, you could use JTAG as you suggest. We don’t document this way, but our beta program used it and we have some unofficial instructions I would be happy to share with you if you wanted to go this route. Let me know


#3

Thank you @eric

EDIT: Actually, I don’t see anywhere how to OTA flash the firmware in the Gateway Shield’s BLE module. That’s what I most need to do right now. It doesn’t show up in my iOS Bluz app. So I figure it’s simply not OTA compliant?

Perhaps you could PM me that link? I should have been in the Beta program. Had other stuff going on. Better late than never. :wink:

I have a solid track record for bricking IoT widgets … so JTAG is my preferred set-up, just in case I need it! :smiley: I just read on the J-Link shield docs page that my ST-Link v2 should do the job. Is that your personal choice or do you prefer the Segger JLink?

I have had all kinds of silly trouble with firmware versions in my ST-Link (with OpenOCD reverse engineered tools) and in fact, had not even heard of the Segger until now. I’ll look it up.

I’ll also go find some official documentation on the topic of NRF51’ programming and debugging, in general. Helps to have the basics straight in my head, sometimes.

Thanks again,

Gruvin


#4

I just invited you to the beta repo, it has a pretty good list of instructions. It is a little outdated, but shows how we programmed everything.

Your STLink v2 will work just fine, so will a JLink. You do need a 9-pin compatible interface, I like my JLink Lite because that is the default on it. Or you can get a converter for the 20 pin connector: https://www.adafruit.com/products/2094. If you use an STLink, it erases everything first, so you have to flash all four files every time if you use it. If you use a JLink, you only need to flash the relevant files as it won’t erase the entire flash space each time. You can see the four parts here: http://docs.bluz.io/tutorials/updates/#firmware-parts

We use Adalink to program. It can use a JLink or STLink v2 and make it really easy to flash files. The links to use it are on the beta page.

The gateway shield is OTA compliant as well. Using the Particle CLI you can just do:

particle flash bluz_gw system-part1.bin

Assuming you named your gateway bluz_gw and you were flashing the system firmware. That will be slower than the JTAG, so you may just want to use that if you have the right equipment.


#5

Thanks again @eric. I’ve joined and now have access to the Beta area.

Sorry to be a pain on this, but my nearest distributor for Segger gear is here: Segger products available from distributor in Australia.

None of those appear to have the “default” 9-Pin connector you mentioned and none of them have, “Lite” in their name. So I’m a little confused.

I do want to get one of these. They seem more reliable and less frustrating to use (on a Mac at least) compared to the ST-Link.

Gruvin

P.S: I have other problems now, too. But I started a new topic for that, in hopes it may not burden you further. We’ll see who bites. :wink:


#6

I don’t see the right thing in here, though I have seen adapters elsewhere. It may not hurt to send them an email and see if they have an adapter in stock, that would be much easier and cheaper then buying a whole new programmer. What you need is an adapter from the standard 20-pin JTAG to 10-pin SWD. The 10-pin has 0.05" spacing. If you could even find a breakout board for that type of connector, you could breadboard the JTAG adapter to the gateway shield.

The JLink Lite I think isn’t widely available too much anymore, they used to be available but I can’t seem to find it online anywhere at the moment. Mine is like 2-3 years old, so I hope they are still making them.

Let me know if you can find what you need.


#7

Thanks @eric. I can figure it out from there. Oh … I did learn that the Segger JLink Lite is only supplied bundled with their dev kits.

There are clones on eBay. They’re dirt cheap with free shipping so I’ll get a couple different ones and see what happens. In the meantime, I’ll hopefully be able to get the ST-Linkv2 to work.