arduino-nRF5 icon indicating copy to clipboard operation
arduino-nRF5 copied to clipboard

Add mbed disk programmer option

Open sandeepmistry opened this issue 7 years ago • 20 comments

During #HackIllinois2017 @jacobrosenthal observed many issues with Windows and Zadig.

Need to explore adding a option to upload using the mbed disk using a batch file (windows) and shell script (Linux/Mac).

Rough set of steps needed:

  1. Build .hex file and merge soft device. If soft device is not erased during upload we can skip the merge step.
  2. Detect mbed drive location via checking drives for a MBED.htm file
  3. Copy file to mbed disk drive.

sandeepmistry avatar Mar 02 '17 01:03 sandeepmistry

I've been using the Segger upload tools instead of the current method and I find it's more reliable. All you need is the Nordic tool kit (free) and a batch file on Windows. There's no code to maintain other than the batch file. There's also the benefit of supporting normal, non-integrated Segger debug probes.

dlabun avatar Mar 02 '17 01:03 dlabun

@dlabun could this approach work for Mac and Linux too?

@jacobrosenthal what do you think of this? I think the one advantage of the mbed approach is it would also work with CMSIS DAP programmers too.

sandeepmistry avatar Mar 02 '17 01:03 sandeepmistry

Yes it would as Nordic has the tool kit for Mac and Linux as well.... They call it the Command Line Tools on the link below.

http://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK#Downloads

dlabun avatar Mar 02 '17 01:03 dlabun

As a side note, Nordic has updated the OB-JLink firmware to rev 160914.

dlabun avatar Mar 02 '17 01:03 dlabun

Id say go with the segger stuff. The mbed disk is pretty pervasive, but theres no feedback except the fail file and we dont want to be digging around in there for success/fail messages

That said, license issues? Id hate to add a fourth component to download its already pretty arduous. I guess it could be bundled with the softdevice download?

On Wed, Mar 1, 2017 at 6:36 PM, dlabun [email protected] wrote:

Yes it would as Nordic has the tool kit for Mac and Linux as well.... They call it the Command Line Tools on the link below.

http://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/ nRF52-DK#Downloads

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-nRF5/issues/107#issuecomment-283528851, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb0dKIVI7OovGuA-BGXsIE7HHW97-oQks5rhh03gaJpZM4MQbJk .

jacobrosenthal avatar Mar 02 '17 01:03 jacobrosenthal

As far as I can tell there shouldn't be licensing issues as the tool kit is freely available on the Nordic site, it's being used strictly on Nordic chips as intended and we wouldn't be modifying it.

Adding a fourth component is a good point... Is there a way to make it an optional part of the install? (If you want it, go grab it?)

dlabun avatar Mar 02 '17 01:03 dlabun

Wait, what sandeep said.

The segger stuff will only work with jlink devices, and the mbed stuff is going to be cmsisdap based..

On Wed, Mar 1, 2017 at 6:44 PM, dlabun [email protected] wrote:

As far as I can tell there shouldn't be licensing issues as the tool kit is freely available on the Nordic site, it's being used strictly on Nordic chips as intended and we wouldn't be modifying it.

Adding a fourth component is a good point... Is there a way to make it an optional part of the install? (If you want it, go grab it?)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-nRF5/issues/107#issuecomment-283530167, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb0dEjqxubL9L8z4mp-6LZw8r6nSJsTks5rhh79gaJpZM4MQbJk .

jacobrosenthal avatar Mar 02 '17 01:03 jacobrosenthal

Hmm... You almost need 3 different upload methods to cover all of the tools out there. May you could do 3 different editions of the core? For example v0.3-OpenOCD, -Segger or -mbed... Only difference being the flashing tool that installed.

dlabun avatar Mar 02 '17 01:03 dlabun

I dont love that. If theres no licensing then just bundle the smallest subset and make it a larger download.

On Wed, Mar 1, 2017 at 6:51 PM, dlabun [email protected] wrote:

Hmm... You almost need 3 different upload methods to cover all of the tools out there. May you could do 3 different editions of the core? For example v0.3-OpenOCD, -Segger or -mbed... Only difference being the flashing tool that installed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-nRF5/issues/107#issuecomment-283531334, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb0dALNf2fys10-8xm214DI6kVJVnrIks5rhiCmgaJpZM4MQbJk .

jacobrosenthal avatar Mar 02 '17 01:03 jacobrosenthal

Well the Linux package was 770kb to download, Win32 installer was 24mb... I don't think that will be too bad

dlabun avatar Mar 02 '17 01:03 dlabun

I wonder if this is just a virtual serial port driver, or if it does anything with cmsisdap. Not sure we tried it this weekend. https://developer.mbed.org/handbook/Windows-serial-configuration#1-download-the-mbed-windows-serial-port

On Wed, Mar 1, 2017 at 6:56 PM, dlabun [email protected] wrote:

Well the Linux package was 770kb to download, Win32 installer was 24mb... I don't think that will be too bad

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-nRF5/issues/107#issuecomment-283532236, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb0dJOZkUT78R_mqLaq8xuvvrLtLNDsks5rhiHrgaJpZM4MQbJk .

jacobrosenthal avatar Mar 02 '17 02:03 jacobrosenthal

The DAP part is based on USB HID, not sure if you need a driver for it.

Should I rename this issue to something more like "Improve Windows setup"?

sandeepmistry avatar Mar 02 '17 02:03 sandeepmistry

Ill get a windows vm and see what the hell it shows up as

On Wed, Mar 1, 2017 at 7:17 PM, Sandeep Mistry [email protected] wrote:

The DAP part is based on USB HID, not sure if you need a driver for it.

Should I rename this issue to something more like "Improve Windows setup"?

jacobrosenthal avatar Mar 02 '17 02:03 jacobrosenthal

So I just this very bolded warning on the mbed website regarding the nrf51 and 52 DKs... Could be rather inconvenient

Please note that there is a behaviour change between this firmware and the J-Link firmware - with the mbed firmware you must press the 'BOOT/RESET' button the board to run your code once it has been downloaded *

dlabun avatar Mar 02 '17 03:03 dlabun

So I figured out drivers mostly. I think we could use the mbed as an option and if it works for most people so be it.

tested in windows 8 vm

For a tinyble mbed device: seems like this mbed driver link installs serial and hid drivers! https://developer.mbed.org/handbook/Windows-serial-configuration#1-download-the-mbed-windows-serial-port

For my nrf51 dongle (segger jlink), after windows takes FOREVER to install its driver: zadig instructions are correct, but interface 2 is called BULK

jacobrosenthal avatar Mar 02 '17 08:03 jacobrosenthal

Also I think maybe better roll back instructions are from https://github.com/pbatard/libwdi/issues/8 Device manager -> right click on device -> uninstall and make sure to check box for "Delete the driver software for this device"

jacobrosenthal avatar Mar 02 '17 08:03 jacobrosenthal

@dlabun at least for tinyble and nrf51 dongle theres no manual reset needed shrug

jacobrosenthal avatar Mar 02 '17 08:03 jacobrosenthal

Also I think maybe better roll back instructions are from pbatard/libwdi#8

For sure, there's a similar PR for node-bluetooth-hci-socket: https://github.com/sandeepmistry/node-bluetooth-hci-socket/pull/54#issuecomment-277601713

A nice gif would be sweet as well.

@dlabun does your JLINK also have a USB MSD disk? The one in my nRF52DK does, not sure if this means I'm using the mbed f/w.

sandeepmistry avatar Mar 03 '17 01:03 sandeepmistry

@sandeepmistry Yes, there's a USB MSD with the jlink firmware.

dlabun avatar Mar 03 '17 13:03 dlabun

Ok, then I think we can just copy of the hex file mbed style with the jlink firmware too.

sandeepmistry avatar Mar 13 '17 01:03 sandeepmistry