You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Peter Jones <ml...@devalot.com> on 2017/05/25 18:39:39 UTC

nRF52 without J-Link?

Is it possible to use newt to flash a nRF52 without having to use
J-Link?

The getting started guide seems to imply that OpenOCD version 0.10.0 is
an option but I can't seem to figure out how to make `newt load' use
it.  I tried setting `OPENOCD_DEBUG=1' without luck:

    $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
    $ newt load --verbose nrf52_boot

...still tries to use J-Link.

I want to avoid using J-Link because:

  1) Pragmatic reason: I'm having a hard time getting J-Link to work on
     my OS (NixOS)

  2) Philosophical reason: I'm building a completely open product and
     would like to have the entire tool chain open as well.  I'm a firm
     supporter of Open Source and relying on proprietary software like
     J-Link makes me uncomfortable.

Thanks.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

Re: nRF52 without J-Link?

Posted by Pierre Kircher <pk...@me.com>.
black magic probe is opensource and runs on the st-link v2 hardware - you can use 2 to flash 1 with the other

> On 25 May 2017, at 23:24, Chris Merck <me...@olibra.io> wrote:
> 
> Hi Peter,
> 
> I use an ST-LINK V2, which costs $3-$12 depending where you buy online.
> 
> Loading and debugging works with the stock nrf52.cfg and stlink-v2.cfg
> files provided by OpenOCD 0.10.0.
> 
> Though ST-LINK is not a FOSS hw design, it is cheap and doesn't require
> proprietary drivers.
> 
> Regards,
> Chris
> 
> On Thu, May 25, 2017 at 3:05 PM, Wayne Keenan <wa...@gmail.com>
> wrote:
> 
>> Hi Peter,
>> 
>> I've used OpenOCD on a Pi with just jumper wires to program an nRF51, for
>> reference:
>> 
>> https://chisight.wordpress.com/2016/03/22/openocd-for-
>> programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/
>> 
>> https://learn.adafruit.com/programming-microcontrollers-
>> using-openocd-on-raspberry-pi/wiring-and-test
>> 
>> 
>> 
>> Just as a FYI: I was doing the above and also using avrdude + jumper wires
>> for AVR's at the same time and although I don't recall having many/any
>> issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
>> occasionally using something like:
>> 
>> echo 4 22 23 18 | xargs -n 1 gpio unexport
>> 
>> If you run into troubles then maybe try that (check the pins match your
>> OpenOCD config)
>> 
>> 
>> Regards
>> Wayne
>> 
>> On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:
>> 
>>> Is it possible to use newt to flash a nRF52 without having to use
>>> J-Link?
>>> 
>>> The getting started guide seems to imply that OpenOCD version 0.10.0 is
>>> an option but I can't seem to figure out how to make `newt load' use
>>> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
>>> 
>>>    $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
>>>    $ newt load --verbose nrf52_boot
>>> 
>>> ...still tries to use J-Link.
>>> 
>>> I want to avoid using J-Link because:
>>> 
>>>  1) Pragmatic reason: I'm having a hard time getting J-Link to work on
>>>     my OS (NixOS)
>>> 
>>>  2) Philosophical reason: I'm building a completely open product and
>>>     would like to have the entire tool chain open as well.  I'm a firm
>>>     supporter of Open Source and relying on proprietary software like
>>>     J-Link makes me uncomfortable.
>>> 
>>> Thanks.
>>> 
>>> --
>>> Peter Jones, Founder, Devalot.com
>>> Defending the honor of good code
>>> 
>> 


Re: nRF52 without J-Link?

Posted by marko kiiskila <ma...@runtime.io>.
Hmmm, email attachments get stripped by the mailing list?

Lemme see where to put it.

> On May 30, 2017, at 12:52 PM, marko kiiskila <ma...@runtime.io> wrote:
> 
> Try this:
> <openocd-0.10.0.patch>
> 
> Hopefully it has all the salient parts.
> 
>> On May 26, 2017, at 12:55 AM, Simon Ratner <si...@proxy.co> wrote:
>> 
>> Marko,
>> 
>> Do you happen to have a link to the patches you applied to openocd? I am
>> building my own, and would like to incorporate them.
>> 
>> Cheers,
>> simon
>> 
>> 
>> On Thu, May 25, 2017 at 3:39 PM, marko kiiskila <ma...@runtime.io> wrote:
>> 
>>> Peter,
>>> 
>>> What’s missing from stock 0.10.0 for nrf52 is the capability to write/erase
>>> the flash. That’s why we have our own tarball for openocd here:
>>> http://mynewt.apache.org/latest/os/get_started/cross_tools/ <
>>> http://mynewt.apache.org/latest/os/get_started/cross_tools/>
>>> 
>>> I have not tried using openocd with JLink, but we do use it with Arduino
>>> Primo with CMSIS-DAP. For reference, check out the download/debug scripts
>>> for that
>>> https://github.com/apache/incubator-mynewt-core/blob/
>>> master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg <
>>> https://github.com/apache/incubator-mynewt-core/blob/
>>> master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg>
>>> 
>>> OPENOCD_DEBUG setting is not present for all BSP scripts. It does
>>> exist for Arduino Primo; take a look at how it is checked here:
>>> https://github.com/apache/incubator-mynewt-core/blob/
>>> master/hw/bsp/arduino_primo_nrf52/primo_download.sh <
>>> https://github.com/apache/incubator-mynewt-core/blob/
>>> master/hw/bsp/arduino_primo_nrf52/primo_download.sh>
>>> If you’re using nrf52dk, you can see from the matching file that it does
>>> not have matching pieces there.
>>> 
>>> I *think* I built the tarball with J-Link option present as well, but I
>>> admit
>>> that I have not tried it. If it’s not there, I can put up the sources for
>>> it,
>>> and you can build it in. And share how you built it, so I can do the same.
>>> 
>>> If you get it to work, and want to have the openocd option for nrf52dk,
>>> submit a patch!
>>> 
>>> Good luck,
>>> M
>>> 
>>>> On May 25, 2017, at 3:24 PM, Chris Merck <me...@olibra.io> wrote:
>>>> 
>>>> Hi Peter,
>>>> 
>>>> I use an ST-LINK V2, which costs $3-$12 depending where you buy online.
>>>> 
>>>> Loading and debugging works with the stock nrf52.cfg and stlink-v2.cfg
>>>> files provided by OpenOCD 0.10.0.
>>>> 
>>>> Though ST-LINK is not a FOSS hw design, it is cheap and doesn't require
>>>> proprietary drivers.
>>>> 
>>>> Regards,
>>>> Chris
>>>> 
>>>> On Thu, May 25, 2017 at 3:05 PM, Wayne Keenan <wa...@gmail.com>
>>>> wrote:
>>>> 
>>>>> Hi Peter,
>>>>> 
>>>>> I've used OpenOCD on a Pi with just jumper wires to program an nRF51,
>>> for
>>>>> reference:
>>>>> 
>>>>> https://chisight.wordpress.com/2016/03/22/openocd-for-
>>>>> programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/
>>>>> 
>>>>> https://learn.adafruit.com/programming-microcontrollers-
>>>>> using-openocd-on-raspberry-pi/wiring-and-test
>>>>> 
>>>>> 
>>>>> 
>>>>> Just as a FYI: I was doing the above and also using avrdude + jumper
>>> wires
>>>>> for AVR's at the same time and although I don't recall having many/any
>>>>> issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
>>>>> occasionally using something like:
>>>>> 
>>>>> echo 4 22 23 18 | xargs -n 1 gpio unexport
>>>>> 
>>>>> If you run into troubles then maybe try that (check the pins match your
>>>>> OpenOCD config)
>>>>> 
>>>>> 
>>>>> Regards
>>>>> Wayne
>>>>> 
>>>>> On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:
>>>>> 
>>>>>> Is it possible to use newt to flash a nRF52 without having to use
>>>>>> J-Link?
>>>>>> 
>>>>>> The getting started guide seems to imply that OpenOCD version 0.10.0 is
>>>>>> an option but I can't seem to figure out how to make `newt load' use
>>>>>> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
>>>>>> 
>>>>>>  $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
>>>>>>  $ newt load --verbose nrf52_boot
>>>>>> 
>>>>>> ...still tries to use J-Link.
>>>>>> 
>>>>>> I want to avoid using J-Link because:
>>>>>> 
>>>>>> 1) Pragmatic reason: I'm having a hard time getting J-Link to work on
>>>>>>   my OS (NixOS)
>>>>>> 
>>>>>> 2) Philosophical reason: I'm building a completely open product and
>>>>>>   would like to have the entire tool chain open as well.  I'm a firm
>>>>>>   supporter of Open Source and relying on proprietary software like
>>>>>>   J-Link makes me uncomfortable.
>>>>>> 
>>>>>> Thanks.
>>>>>> 
>>>>>> --
>>>>>> Peter Jones, Founder, Devalot.com
>>>>>> Defending the honor of good code
>>>>>> 
>>>>> 
>>> 
>>> 
> 


Re: nRF52 without J-Link?

Posted by marko kiiskila <ma...@runtime.io>.
Try this:

Re: nRF52 without J-Link?

Posted by Simon Ratner <si...@proxy.co>.
Marko,

Do you happen to have a link to the patches you applied to openocd? I am
building my own, and would like to incorporate them.

Cheers,
simon


On Thu, May 25, 2017 at 3:39 PM, marko kiiskila <ma...@runtime.io> wrote:

> Peter,
>
> What’s missing from stock 0.10.0 for nrf52 is the capability to write/erase
> the flash. That’s why we have our own tarball for openocd here:
> http://mynewt.apache.org/latest/os/get_started/cross_tools/ <
> http://mynewt.apache.org/latest/os/get_started/cross_tools/>
>
> I have not tried using openocd with JLink, but we do use it with Arduino
> Primo with CMSIS-DAP. For reference, check out the download/debug scripts
> for that
> https://github.com/apache/incubator-mynewt-core/blob/
> master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg <
> https://github.com/apache/incubator-mynewt-core/blob/
> master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg>
>
> OPENOCD_DEBUG setting is not present for all BSP scripts. It does
> exist for Arduino Primo; take a look at how it is checked here:
> https://github.com/apache/incubator-mynewt-core/blob/
> master/hw/bsp/arduino_primo_nrf52/primo_download.sh <
> https://github.com/apache/incubator-mynewt-core/blob/
> master/hw/bsp/arduino_primo_nrf52/primo_download.sh>
> If you’re using nrf52dk, you can see from the matching file that it does
> not have matching pieces there.
>
> I *think* I built the tarball with J-Link option present as well, but I
> admit
> that I have not tried it. If it’s not there, I can put up the sources for
> it,
> and you can build it in. And share how you built it, so I can do the same.
>
> If you get it to work, and want to have the openocd option for nrf52dk,
> submit a patch!
>
> Good luck,
> M
>
> > On May 25, 2017, at 3:24 PM, Chris Merck <me...@olibra.io> wrote:
> >
> > Hi Peter,
> >
> > I use an ST-LINK V2, which costs $3-$12 depending where you buy online.
> >
> > Loading and debugging works with the stock nrf52.cfg and stlink-v2.cfg
> > files provided by OpenOCD 0.10.0.
> >
> > Though ST-LINK is not a FOSS hw design, it is cheap and doesn't require
> > proprietary drivers.
> >
> > Regards,
> > Chris
> >
> > On Thu, May 25, 2017 at 3:05 PM, Wayne Keenan <wa...@gmail.com>
> > wrote:
> >
> >> Hi Peter,
> >>
> >> I've used OpenOCD on a Pi with just jumper wires to program an nRF51,
> for
> >> reference:
> >>
> >> https://chisight.wordpress.com/2016/03/22/openocd-for-
> >> programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/
> >>
> >> https://learn.adafruit.com/programming-microcontrollers-
> >> using-openocd-on-raspberry-pi/wiring-and-test
> >>
> >>
> >>
> >> Just as a FYI: I was doing the above and also using avrdude + jumper
> wires
> >> for AVR's at the same time and although I don't recall having many/any
> >> issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
> >> occasionally using something like:
> >>
> >> echo 4 22 23 18 | xargs -n 1 gpio unexport
> >>
> >> If you run into troubles then maybe try that (check the pins match your
> >> OpenOCD config)
> >>
> >>
> >> Regards
> >> Wayne
> >>
> >> On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:
> >>
> >>> Is it possible to use newt to flash a nRF52 without having to use
> >>> J-Link?
> >>>
> >>> The getting started guide seems to imply that OpenOCD version 0.10.0 is
> >>> an option but I can't seem to figure out how to make `newt load' use
> >>> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
> >>>
> >>>    $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
> >>>    $ newt load --verbose nrf52_boot
> >>>
> >>> ...still tries to use J-Link.
> >>>
> >>> I want to avoid using J-Link because:
> >>>
> >>>  1) Pragmatic reason: I'm having a hard time getting J-Link to work on
> >>>     my OS (NixOS)
> >>>
> >>>  2) Philosophical reason: I'm building a completely open product and
> >>>     would like to have the entire tool chain open as well.  I'm a firm
> >>>     supporter of Open Source and relying on proprietary software like
> >>>     J-Link makes me uncomfortable.
> >>>
> >>> Thanks.
> >>>
> >>> --
> >>> Peter Jones, Founder, Devalot.com
> >>> Defending the honor of good code
> >>>
> >>
>
>

Re: nRF52 without J-Link?

Posted by marko kiiskila <ma...@runtime.io>.
Peter,

What’s missing from stock 0.10.0 for nrf52 is the capability to write/erase
the flash. That’s why we have our own tarball for openocd here:
http://mynewt.apache.org/latest/os/get_started/cross_tools/ <http://mynewt.apache.org/latest/os/get_started/cross_tools/>

I have not tried using openocd with JLink, but we do use it with Arduino
Primo with CMSIS-DAP. For reference, check out the download/debug scripts for that
https://github.com/apache/incubator-mynewt-core/blob/master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg <https://github.com/apache/incubator-mynewt-core/blob/master/hw/bsp/arduino_primo_nrf52/arduino_primo.cfg>

OPENOCD_DEBUG setting is not present for all BSP scripts. It does
exist for Arduino Primo; take a look at how it is checked here:
https://github.com/apache/incubator-mynewt-core/blob/master/hw/bsp/arduino_primo_nrf52/primo_download.sh <https://github.com/apache/incubator-mynewt-core/blob/master/hw/bsp/arduino_primo_nrf52/primo_download.sh>
If you’re using nrf52dk, you can see from the matching file that it does
not have matching pieces there.

I *think* I built the tarball with J-Link option present as well, but I admit
that I have not tried it. If it’s not there, I can put up the sources for it,
and you can build it in. And share how you built it, so I can do the same.

If you get it to work, and want to have the openocd option for nrf52dk,
submit a patch!

Good luck,
M

> On May 25, 2017, at 3:24 PM, Chris Merck <me...@olibra.io> wrote:
> 
> Hi Peter,
> 
> I use an ST-LINK V2, which costs $3-$12 depending where you buy online.
> 
> Loading and debugging works with the stock nrf52.cfg and stlink-v2.cfg
> files provided by OpenOCD 0.10.0.
> 
> Though ST-LINK is not a FOSS hw design, it is cheap and doesn't require
> proprietary drivers.
> 
> Regards,
> Chris
> 
> On Thu, May 25, 2017 at 3:05 PM, Wayne Keenan <wa...@gmail.com>
> wrote:
> 
>> Hi Peter,
>> 
>> I've used OpenOCD on a Pi with just jumper wires to program an nRF51, for
>> reference:
>> 
>> https://chisight.wordpress.com/2016/03/22/openocd-for-
>> programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/
>> 
>> https://learn.adafruit.com/programming-microcontrollers-
>> using-openocd-on-raspberry-pi/wiring-and-test
>> 
>> 
>> 
>> Just as a FYI: I was doing the above and also using avrdude + jumper wires
>> for AVR's at the same time and although I don't recall having many/any
>> issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
>> occasionally using something like:
>> 
>> echo 4 22 23 18 | xargs -n 1 gpio unexport
>> 
>> If you run into troubles then maybe try that (check the pins match your
>> OpenOCD config)
>> 
>> 
>> Regards
>> Wayne
>> 
>> On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:
>> 
>>> Is it possible to use newt to flash a nRF52 without having to use
>>> J-Link?
>>> 
>>> The getting started guide seems to imply that OpenOCD version 0.10.0 is
>>> an option but I can't seem to figure out how to make `newt load' use
>>> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
>>> 
>>>    $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
>>>    $ newt load --verbose nrf52_boot
>>> 
>>> ...still tries to use J-Link.
>>> 
>>> I want to avoid using J-Link because:
>>> 
>>>  1) Pragmatic reason: I'm having a hard time getting J-Link to work on
>>>     my OS (NixOS)
>>> 
>>>  2) Philosophical reason: I'm building a completely open product and
>>>     would like to have the entire tool chain open as well.  I'm a firm
>>>     supporter of Open Source and relying on proprietary software like
>>>     J-Link makes me uncomfortable.
>>> 
>>> Thanks.
>>> 
>>> --
>>> Peter Jones, Founder, Devalot.com
>>> Defending the honor of good code
>>> 
>> 


Re: nRF52 without J-Link?

Posted by Chris Merck <me...@olibra.io>.
Hi Peter,

 I use an ST-LINK V2, which costs $3-$12 depending where you buy online.

 Loading and debugging works with the stock nrf52.cfg and stlink-v2.cfg
files provided by OpenOCD 0.10.0.

 Though ST-LINK is not a FOSS hw design, it is cheap and doesn't require
proprietary drivers.

Regards,
 Chris

On Thu, May 25, 2017 at 3:05 PM, Wayne Keenan <wa...@gmail.com>
wrote:

> Hi Peter,
>
> I've used OpenOCD on a Pi with just jumper wires to program an nRF51, for
> reference:
>
> https://chisight.wordpress.com/2016/03/22/openocd-for-
> programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/
>
> https://learn.adafruit.com/programming-microcontrollers-
> using-openocd-on-raspberry-pi/wiring-and-test
>
>
>
> Just as a FYI: I was doing the above and also using avrdude + jumper wires
> for AVR's at the same time and although I don't recall having many/any
> issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
> occasionally using something like:
>
> echo 4 22 23 18 | xargs -n 1 gpio unexport
>
> If you run into troubles then maybe try that (check the pins match your
> OpenOCD config)
>
>
> Regards
> Wayne
>
> On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:
>
> > Is it possible to use newt to flash a nRF52 without having to use
> > J-Link?
> >
> > The getting started guide seems to imply that OpenOCD version 0.10.0 is
> > an option but I can't seem to figure out how to make `newt load' use
> > it.  I tried setting `OPENOCD_DEBUG=1' without luck:
> >
> >     $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
> >     $ newt load --verbose nrf52_boot
> >
> > ...still tries to use J-Link.
> >
> > I want to avoid using J-Link because:
> >
> >   1) Pragmatic reason: I'm having a hard time getting J-Link to work on
> >      my OS (NixOS)
> >
> >   2) Philosophical reason: I'm building a completely open product and
> >      would like to have the entire tool chain open as well.  I'm a firm
> >      supporter of Open Source and relying on proprietary software like
> >      J-Link makes me uncomfortable.
> >
> > Thanks.
> >
> > --
> > Peter Jones, Founder, Devalot.com
> > Defending the honor of good code
> >
>

Re: nRF52 without J-Link?

Posted by Wayne Keenan <wa...@gmail.com>.
Hi Peter,

I've used OpenOCD on a Pi with just jumper wires to program an nRF51, for
reference:

https://chisight.wordpress.com/2016/03/22/openocd-for-programming-nrf51822-via-nothing-but-wires-and-a-raspberry-pi/

https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/wiring-and-test



Just as a FYI: I was doing the above and also using avrdude + jumper wires
for AVR's at the same time and although I don't recall having many/any
issues using OpenOCD I was having to manually 'free' the Pi's GPIO pins
occasionally using something like:

echo 4 22 23 18 | xargs -n 1 gpio unexport

If you run into troubles then maybe try that (check the pins match your
OpenOCD config)


Regards
Wayne

On 25 May 2017 at 19:39, Peter Jones <ml...@devalot.com> wrote:

> Is it possible to use newt to flash a nRF52 without having to use
> J-Link?
>
> The getting started guide seems to imply that OpenOCD version 0.10.0 is
> an option but I can't seem to figure out how to make `newt load' use
> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
>
>     $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
>     $ newt load --verbose nrf52_boot
>
> ...still tries to use J-Link.
>
> I want to avoid using J-Link because:
>
>   1) Pragmatic reason: I'm having a hard time getting J-Link to work on
>      my OS (NixOS)
>
>   2) Philosophical reason: I'm building a completely open product and
>      would like to have the entire tool chain open as well.  I'm a firm
>      supporter of Open Source and relying on proprietary software like
>      J-Link makes me uncomfortable.
>
> Thanks.
>
> --
> Peter Jones, Founder, Devalot.com
> Defending the honor of good code
>

Re: nRF52 without J-Link?

Posted by Pierre Kircher <pk...@me.com>.
you dont have to use jlink or the devboard ..

yet .. its the easyest beause the hardware is already implemented ..

> as for opensource .. you can use the blackmagic probe open hard/firmware

and works just fine with the nrf52 > you would however need to define the hardware in mynewt. the “hw” folder should give you a starting point


> On 25 May 2017, at 19:39, Peter Jones <ml...@devalot.com> wrote:
> 
> Is it possible to use newt to flash a nRF52 without having to use
> J-Link?
> 
> The getting started guide seems to imply that OpenOCD version 0.10.0 is
> an option but I can't seem to figure out how to make `newt load' use
> it.  I tried setting `OPENOCD_DEBUG=1' without luck:
> 
>    $ newt target set nrf52_blinky syscfg=OPENOCD_DEBUG=1
>    $ newt load --verbose nrf52_boot
> 
> ...still tries to use J-Link.
> 
> I want to avoid using J-Link because:
> 
>  1) Pragmatic reason: I'm having a hard time getting J-Link to work on
>     my OS (NixOS)
> 
>  2) Philosophical reason: I'm building a completely open product and
>     would like to have the entire tool chain open as well.  I'm a firm
>     supporter of Open Source and relying on proprietary software like
>     J-Link makes me uncomfortable.
> 
> Thanks.
> 
> --
> Peter Jones, Founder, Devalot.com
> Defending the honor of good code