In-circuit programmer debugger ICD2 + Ubuntu
Linux development is easy!
This topic will be dedicated to connecting the Olimex debugger programmer - ICD2 on Linux.
Since I almost did not find information on the Internet on this subject, let me tell myself how I did it.
It’s not tricky to guess what you need to know on which distribution we will install. My choice fell on Ubuntu 8.10. The kernel is currently installed version 2.6.27-11-generic (unstable in general).
However, this is a very friendly and easy-to-use distribution, but the rake when connecting could not be avoided.
And so, let's start in order.
- Install the latest version of piklab.
Install with the command:
$ sudo aptitude install piklab
The package manager will pull dependencies in the form of KDE, it turns out quite a lot if you do not have KDE.
So, we installed piklab. Now you need to complete the second step:
- connection of the ICD2 programmer.
After connecting and waiting 10 seconds, you should run the lsusb command.
bond @ bond-desktop: ~ $ lsusb
Bus 003 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub
...
Bus 001 Device 007: ID 04d8: 8000 Microchip Technology, Inc. In-Circuit Debugger
...
Bus 001 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub
If you have not seen your debugger, then I think it is worthwhile to slow down the reading of this article for an indefinite period and find out why it does not see it. If everything is OK - move on. The next step will be:
- ICD2 setup in Piklab
bond @ bond-desktop: ~ $ sudo addgroup microchip && sudo addgroup bond microchip
Adds the group `microchip '(GID 1002) ...
Done.
The user `bond 'is
added to the group` microchip' ... Adding the user bond to the group microchip
Done.
bond @ bond-desktop: ~ $
Then, if everything went well, you need to create a file - the rule. Well, let's create it.
$ sudo touch /etc/udev/rules.d/026_microchip.rules
Then, copy this text to the file that we created: And now it's a mess - we need HEX files from the original MPLAB program. If there are no Windows in parallel, then you have to go to a friend and install the original MPLAB IDE from him and from the folder C: \ program files \ microchip \ _where_to_copy the ICD2 directory. There are firmware for the programmer. Then we put our catalog with firmware anywhere, the main thing is not to be rubbed. We start Piklab. Click on the buttons: Programmer -> Settings -> Programmer selection In the Port Selection tab, point to a USB, go to the tab to the right - Specific
#PICKit
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0032", MODE="0660", GROUP="microchip"
#PICKit2
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="0033", MODE="0660", GROUP="microchip"
#ICD2
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8000", MODE="0660", GROUP="microchip"
#ICD21
SYSFS{idVendor}=="04d8", SYSFS{idProduct}=="8001", MODE="0660", GROUP="microchip"there we indicate the path to our folder with HEX files. Now you can close the windows and Piklab. Run again and click on the top menu Programmer -> Connect.
In the log below we should see something like this:
Connecting ICD2 Programmer on USB Port with device 16F876A ...
Firmware id is 1 and we want 1
Firmware version is 2.7.2
Set target
Set target self powered: false
Hold reset reset
Programmer Vpp = 12.9406 V
Target Vdd = 5.04132 V
Target Vpp = 12.9406 V
Self -test
Connected.
Enter normal mode
Already in requested mode.
Read id: 16F876A (rev. 7)
That's all :) And now you can create a new project and write a program for it. Installing a good compiler will be discussed in the next article.
Problems and solutions
Problem: Piklab writes something similar in the log:Connecting ICD2 Programmer on USB Port with device 16F876A ...
USB Port: Error resetting USB device. (err = could not reset: Operation not permitted).
Solution: Put the permissions ( crw-rw-rw- ) on the device file in the / dev / bus / usb / [ bus ] / [ device ] directory.
We already saw this data, repeat the lsusb command:
Bus 001 Device 008 : ID 04d8: 8001 Microchip Technology, Inc. ICD2 in-circuit debugger
Problem: Piklab swears and asks Firmwere.
Solution: Check the path to the HEX files in the ICD2 directory. Also check the rights to the device. See above.
Problem: Piklab crashes when you try to change the settings from the lower left menu.
Solution: Alas, I can’t help with anything - make settings from the top menu.