Linux development is easy!
This topic will be devoted to connecting the Olimex debugger programmer ICD2 on Linux.
Since I almost did not find information on the Internet on this subject, I will allow myself to tell myself how I did it.
It is not sly to guess what you need to know on which distribution kit we will install. My choice fell on Ubuntu 8.10. The kernel was currently installed version 2.6.27-11-generic (anstable in general).
However, it is a very friendly and easy-to-use distribution, but it was not possible to avoid a rake when connecting.
And so, let's start in order.
- Install the latest version of piklab.
it is usually in the repository (the repository is the package repository)
Install the command:
')
$ sudo aptitude install piklab
The batch manager will pull dependencies in the form of KDE lib, it turns out quite a lot if you do not have KDE.
So, we installed piklab. Now you need to perform the second step:
- connect the ICD2 programmer.
We connect it to any free USB host.
REMEMBER: Do not connect to card readers and other garbage. Nitsche does not work!
After you have connected and waited 10 seconds, it is worth executing 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 worth stopping reading this article indefinitely and find out why it does not see it. If everything is ok, move on. The next step will be:
- Setting up ICD2 in Piklab
To make everything work for us, we need to create a microchip group and place our user there. We execute the command: sudo addgroup microchip && sudo addgroup bond microchip
Where instead of “bond” - enter the name of your user! Should see something like this:
bond @ bond-desktop: ~ $ sudo addgroup microchip && sudo addgroup bond microchip
The group `microchip '(GID 1002) is added ...
Is done.
The user `bond 'is added to the group` microchip' ...
Add user bond to microchip group
Is done.
bond @ bond-desktop: ~ $
Then, if everything went well, you need to create a file - a rule. Well then - create.
$ sudo touch /etc/udev/rules.d/026_microchip.rules
Then copy this text into the file we created:
#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"
And now the challenge is - we need HEX files from the original MPLAB program. If there are no Windows in parallel, then you will have to go to a friend and install the original MPLAB IDE from him and from the C: \ program files \ microchip \ _ where_to_ here folder Copy the ICD2 directory. There are firmware for the programmer.
Then we put our directory with the firmware anywhere, the main thing so as not to rub it. Run Piklab.
We press on the buttons:
Programmer ->
Settings ->
Programmer selection In the
Port Selection tab, a dot on USB, go to the tab to the right -
Specific specify the path to our folder with HEX files. Now you can close the windows and Piklab. Run again and click in the top menu
Programmer ->
ConnectIn 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
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 :) Now you can create a new project and write a program for it. Installation of a good compiler, will consider in the next article.
Problems and solutions
Problem: Piklab writes something like this 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: Add permissions (
crw-rw-rw- ) to the device file in the / dev / bus / usb / [
bus ] / [
device ] directory
We already saw this data earlier, 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 trying to change settings from the bottom left menu.
Solution: Alas, I can not help you - make settings from the top menu.