Skip to content

pic32prog: add a documentation on how to update PICkit3#9260

Merged
kYc0o merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/pic32/doc
Jun 26, 2018
Merged

pic32prog: add a documentation on how to update PICkit3#9260
kYc0o merged 1 commit intoRIOT-OS:masterfrom
cladmi:pr/pic32/doc

Conversation

@cladmi
Copy link
Contributor

@cladmi cladmi commented May 31, 2018

Contribution description

To use pic32prog, the PICkit3 must be updated with a scripting mode firmware.
This describes how to do it on Linux using a windows VM (free).

I did what was described here: #6092 (comment)

Future work

  • replayed on other computers (also on mac)
  • Adapted to be parsed by doxygen and maybe also in line with the boards documentation migration.
  • Maybe add information for PICkit2 no idea how it works

Issues/PRs references

#6092 (comment)
Documents #9259

@cladmi cladmi added Platform: MIPS Platform: This PR/issue effects MIPS-based platforms Community: help wanted The contributors require help from other members of the community labels May 31, 2018
@cladmi cladmi requested review from jia200x, kYc0o and neiljay May 31, 2018 15:32
@cladmi cladmi added the Area: doc Area: Documentation label May 31, 2018
Flashing on Linux using pickit-3
================================

Allow flashing a pic32-wifire from linux using https://github.com/sergev/pic32prog
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who allows that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... yeah, maybe this needs a rewording, or just remove "Allow".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flashing another firmware on the pickit-3 allows that.
I could go for "Update the pickit-3 firmware to allow flashing..."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to have something a little more descriptive. E.g. "Go to https://github.com/sergev/pic32prog and download the PIC32 programmer software"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(+ build it using make)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be automatically built by the RIOT build system (like edbg).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh, now I understand the sentence.... the link isn't supposed to be followed, but just used as a noun here... Ok... then maybe use some markdown magic here instead ;-):

This document describes how to enable flashing a pic32-wifire from linux using [pic32prog] with a PICkit-3
<!-- .... at the bottom of the document -->
[pic32prog]: https://github.com/sergev/pic32prog


### Setup Windows VM

You can download a free 90 days valid windows virtualbox image from:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do I need to download it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's only if you need to change the firmware of your pickit3 (usually you'll need), and it can only be done under windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this, but it isn't clear from this document.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add a global summary at the beginning explaining what should be done and how:

  • Update pickit-3 firmware to allow flashing from linux
  • Updating the firmware should be done from a windows computer
    • This tutorial will explain how to do it from a virtual machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do net think it would then be necessary to repeat it after if explained at the beginning.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments while trying out the process (won't finish today).

* optional: set an empty password in Settings-Accounts
* optional: Create a shared folder with your host machine. I run an offline
windows machine so download everything from my host.
* Install Virtualbox Guest-additions for USB support (reboot)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could need some details. I know how to do that, but someone who never worked with VirtualBox (or VMs in general) might not know what to do here.

* optional: Create a shared folder with your host machine. I run an offline
windows machine so download everything from my host.
* Install Virtualbox Guest-additions for USB support (reboot)
* USB add both 'microchip' usb as USB1 devices
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could need some details. I know how to do that, but someone who never worked with VirtualBox (or VMs in general) might not know what to do here.

* optional: disabled network
* Start and login with password: Passw0rd!
* optional: set an empty password in Settings-Accounts
* optional: Create a shared folder with your host machine. I run an offline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could need some details. I know how to do that, but someone who never worked with VirtualBox (or VMs in general) might not know what to do here.


* Create a machine in virtualbox in File-Import Appliance.
* optional: disabled network
* Start and login with password: Passw0rd!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My VM (MSEdge - Win10.ova) started without password prompt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will remove it. It is explained on the microsoft page anyway.

I downloaded a Windows 10 virtualbox image

* Create a machine in virtualbox in File-Import Appliance.
* optional: disabled network
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could need some details. I know how to do that, but someone who never worked with VirtualBox (or VMs in general) might not know what to do here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the parts about networking and shared folder as these are just because it is not required to connect your windows to the internet and that I tend to not connect them without antivirus but it should not be the problem of the tutorial.

* optional: Create a shared folder with your host machine. I run an offline
windows machine so download everything from my host.
* Install Virtualbox Guest-additions for USB support (reboot)
* USB add both 'microchip' usb as USB1 devices
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear here, that this enabling USB is only possible, when the machine is shut down.

* Run `setup.exe`
* Run PICkit3
* Tools/Download PICkit Operating System
* Select c://Program Files/Microchip/PICkit3/PK3OSV020005.hex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The application seems to stall during this process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fixed by permanently registering the usb device to auto-reattach it.

* Connect the chipKIT-Wi-Fire to USB
* Connect the PICkit3 to JP1 ICSP holes
* https://docs.creatordev.io/wifire/guides/wifire-programming/
* The Arrow `▶` goes into the hole number 1 (a hole with a square around it)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hole? You probably mean port or pin ;-).

* Tools/Download PICkit Operating System
* Select c://Program Files/Microchip/PICkit3/PK3OSV020005.hex
* Device should be flashed there will be a message saying the board is found
* Turn off your VM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The application is crashing when exiting. Maybe calm the reader down, that this is "normal" ;-).

Programmer for Microchip PIC32 microcontrollers, Version 2.0.221
Copyright: (C) 2011-2015 Serge Vakulenko
Adapter: PICkit3 Version 2.0.5
Processor: MZ2048EFG100 (id 1720E053)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still get No target found. here :-(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a permissions problem after all. Maybe also add a line above that the udev rules need to be adapted:

ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="900a", MODE="664", GROUP="plugdev

@cladmi
Copy link
Contributor Author

cladmi commented Jun 12, 2018

@miri64 Thank you for the thorough review. I tried to address all your comments in separate commits.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor stuff left.

* Shutdown the virtual machine
* In the virtual machine settings, go to USB:
* Select "Enable USB Controller" with "USB 1.1"
* Click the small '+' sign on the right and add the Microchip devices.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The device needs to be plugged in for this)

permission issue.

Add yourself to the `plugdev` group, add the following `udev` rule and reboot.
(Find a tutorial if you do not know how to do this).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTFM is not very friendly. Especially since explaining that you need to add the rule to a file in /etc/udev/rules.d is just as short ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeaaaaahhh you are right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked my files and found that I had mplab udev rules, that is why it was detected on my computer.

They had some wildcard values for idProduct and found this other website talking about rules for these devices: http://en.microstickplus.com/mplabx-on-linux
So I put the link and only use idVendor as selection.

@cladmi cladmi added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 15, 2018
@miri64
Copy link
Member

miri64 commented Jun 15, 2018

I guess adding the binary file dist/tools/pic32prog/pic32prog in the last commit wasn't your intention ;-)

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits, some stuff that still isn't quite ironed out, but overall I think if this is fixed (and the binary file removed), we can merge.


It will require flashing a specific firmware on the PICkit3.
As this can only be done from a Windows computer, that not many Linux users
have, the following steps explain how to setup a Windows VirtualBox virtual
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document contains several spellings of VirtualBox (capitalization differs). Please decide on one (I prefer the canonical spelling).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated all to VirtualBox.


* Install Virtualbox
* Add yourself to the 'vboxusers' group
`sudo usermod -a -G vboxusers your_username`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendered this looks a little bit weird due to the missing newline.


* PICkit3-Programmer http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit3%20Programmer%20Application%20v3.10.zip

Adapted from the README (on Windows 10 machine .NET 4.00 is already installed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context of this sentence isn't clear to me (maybe because it is missing a subject or a colon at the end?)


https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

I downloaded a Windows 10 virtualbox image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is "I" (once people only see the markdown in the repo, people might wonder)?

* Run PICkit3
* Tools/Download PICkit Operating System
* Select `c://Program Files/Microchip/PICkit3/PK3OSV020005.hex`
* Device should be flashed there will be a message saying the board is found
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rephrase, this sentence is lacking grammatical structure.


https://github.com/sergev/pic32prog

Run it without the board connected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(but the PICkit3 attached)

USBID pin: controlled by port
```

pic32prog firmware.hex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe write somewhere here, that this is the actual flashing step.

@cladmi
Copy link
Contributor Author

cladmi commented Jun 15, 2018

I tried to address all remarks and looked at the rendered text too: https://github.com/cladmi/RIOT/blob/pr/pic32/doc/dist/tools/pic32prog/doc.md

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammar nit left. Please fix and squash immediately.


* PICkit3-Programmer http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit3%20Programmer%20Application%20v3.10.zip

The steps were adapted from the archive README:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the archive's"

To use pic32prog, the PICkit3 must be updated with a scripting mode firmware.
This describes how to do it on Linux using a windows VM (free).
@cladmi
Copy link
Contributor Author

cladmi commented Jun 18, 2018

Done

@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 18, 2018
@kYc0o
Copy link
Contributor

kYc0o commented Jun 26, 2018

Is this ready to merge?

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 26, 2018
@miri64
Copy link
Member

miri64 commented Jun 26, 2018

Yes, just let Murdock have another go at this.

@kYc0o
Copy link
Contributor

kYc0o commented Jun 26, 2018

Murdock agrees. Go!

@kYc0o kYc0o merged commit 9c612d4 into RIOT-OS:master Jun 26, 2018
@cladmi cladmi deleted the pr/pic32/doc branch June 27, 2018 08:40
@cladmi cladmi added this to the Release 2018.07 milestone Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: doc Area: Documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Community: help wanted The contributors require help from other members of the community Platform: MIPS Platform: This PR/issue effects MIPS-based platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants