This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming different nRF51822 boards how to prog S110 & App?

Hi All,

I am an electronics engineer but new to nRF51822 programming. I have used the PCA10000 & PCA10001 using Nordic SDK, using nRF Studio etc. In nRF Studio, you can program the S110 protocol independently from your own application. I am now trying to program a couple of other modules from a 3rd party, these are: T1RU.hXeXiXXXXXXXX_!!0-item_pic.jpg_460x460.jpg And some PTR5518. I came across this posting here: link text.

The posting is useful however, I am a little confused; I understand that I need to use the SWDIO & SWDCLK pins which I am aware of. I am also using an STM32F0discovery board for programming them which I read was able to program these modules: link text albeit for Linux.

My confusion is; what software do I use to do the programming? In the past with Nordic dev boards I used the nRF Studio which would allow me to program S110 and my own app independently. This board has SWDIO & SWDCLK but obviously wont be compatible with nRF Studio which means I cant program S110 and app separately. If I cant do that, how do you program the S110 into the right memory area (as nRF Studio does)?

I am sorry, I hope I have explained it properly. Initially to program the third party units, I connected a board to the SWDIO & SWDCLK of the PCA board and switched off the slide switch next to the Reset button but and tapped the power jumper/headers next to the Reset button, however, something still seems to be missing as it doesnt seem to program it correctly; if I program S110 first and then app, error is returned "CPU not in reset", if I do app first and then S110, no errors but it doesn not seem to be programmed as it doesnt work.

Is there a particular sequence for the SWDIO and Reset & programming procedure?

Any one can help?

Thanks very much. Sean

  • Hi

    You can program nRF51822 with nrfjprog command line tool. It is a part of nrfTools install.

  • Hi Stefan,

    Thanks for your answer however, that doesnt really tell me much. I am trying to program an nRF51822 on board a 3rd party board by either hot wiring the Nordic dev boards PCA10000 or by hot wiring STM32F0discovery board. The Nordic doesnt seem to do the job for some reason, so I am trying with STM32F0discovery which obviously is a different hardware front end. Do you mean use the Segger software with the STM32F0discovery? If so, a little more detail on how would be good.

    Thanks,

    Sean

  • Hi Sean,

    The nRF51822 uses SWD (Serial Wire Debug), which is a younger cousin ofJTAG, for flashing and debugging boards. Ostensibly, any SWD controller (interface? flasher? I'm not sure of the correct name) will be able to flash or debug the nRF51822.

    Practically, Segger is the only manufacturer that makes an out of the box SWD solution for the nRF51822, at this point in time. Hence, they can charge a lot for their SWD products since there's not much competition. You may have noticed the Segger's IC on the dev kit, they also make these on-PCB SWD controllers that are distributed in dev kits so customers don't have to buy a discrete SWD controller to trial microcontrollers.

    I am not sure if the Segger SWD controller on the dev kit is somehow "locked" to the specific nRF51822 on each board or if it would work as a stand-alone SWD programmer if you could cut the traces from the SWDIO and SWDCLK pins to the on-board nRF51822 and break them out to your custom hardware.

    Even if this works, I doubt Nordic can tell you to do it, since it probably violates their licensing agreement with Segger, who would prefer you buy their commercial products. You can also find unauthorized clones of Segger programmers on Ebay or similar sites, which may or may not work, but certainly also violate Segger's software licensing agreement and diminishes the profits from their hard work :)

    The site you linked mentions OpenOCD, which is an open source free software project that is capable of driving a variety of SWD or JTAG flashers/debuggers, many of which are much cheaper than a Segger J-Link.

    For instance, OpenOCD lets you use an STM ST-Link V2, which normally would only work with STM products when you use STM's software to control it, to program anything that uses an SWD interface, including the nRF51822. The ST-Link V2 is available for about $30 or as part of an STM dev kit, built into the circuit board.

    However, caveat emptor, OpenOCD is still quite fresh and not the easiest software to use. There are known bugs that make it difficult to use out of the box with the nRF51822, however if you're willing to take the time you can find patches and even improve the project yourself.

    My experience from a few months ago is that it will take about a full day to get OpenOCD running and patched to use an ST-Link V2 with the nRF51822. OpenOCD didn't flash nearly as fast as a Segger J-Link, but that could have been improved.

    If money is your constraint, then try OpenOCD and an ST-Link V2, since it's a very promising project that is getting better with every release, but it might take some time to get running.

    If you need things to work quickly, use a Segger J-Link and their flashing software. Their software works better on Windows than Linux or OS X, in my experience.

    Good luck!

  • Hi Cody,

    Thank you very much for your input, that is exactly what I was looking for. I did think that I may not be guided by Nordic support due to the nature of the question but I was hoping for an input like yours. Had a quick look at the OpenOCD for Windows, looks difficult to setup, will keep on looking. As far as moding the Nordic Dev board I havent cut any tracks, just switched off SW4 which disconnects Segger generated SWDIO & SWDCLK signals used for programming the on board nRF from getting to the on board nRF. I then just connected a couple of wires to points on the PCB carrying the same signals to the switch. Essentially, cutting the debug signals getting to the on board nRF and routing it to my own board as well as the GND & 3.3V. Doesnt seem to complain if I program my app first then S110, other way around I get "CPU NOT HOLTED" error. But after 'programming' it doesnt work, not sure if it is locked to on board chip only as you say or I am missing a trick.

    Thanks again.

    Sean

  • Good to hear you have something working. Yes, OpenOCD on Windows is an entirely different beast than on a *nix. It sounds like you might be telling the nRF51822 to run whatever you just flashed if you're getting "CPU NOT HALTED" errors. Either find a way to tell it to NOT run the CPU after flashing an image or you can try flashing both your app and the s110 together, either using one of Nordic's tools or srec_cat to merge them. I'm not familiar with your toolchain, but if you're able to get a .hex file of your application, try using Segger's J-Flash tool to program it and the s110 hex image to your nRF51822 board. It's pretty robust and very fast in my experience.

    Good luck!

Related