I’ve recently got my Raspberry Pi and started to experiment with it afterwards. As an operating system, i choose the latest raspbian image from official Raspberry Pi website. In the future i also want to try to Adafruit’s distro as well. In this post i’ll try to explain how you can program a Pic24f microcontroller by using your Raspberry Pi with the help of Little Wire.
I used my FTDI usb serial converter board to connect to the Raspberry Pi since i don’t have an HDMI supported monitor at hand :)
You should install the libusb development package to compile the Little Wire examples on your Raspberry Pi.
After this, we should install Little Wire package to the device. There are two ways. If you want to use git, you can do
git clone git://github.com/kehribar/Little-Wire.git
Or do this way:
After you installed the library go to
./v1.1/computer_interface/C folder and hit
Now you have the pic24f program , along with the other examples for Little Wire, compiled. You can browse the content of this program from gitHub.
Example usage is like this:
sudo ./pic24f main.hex => This programs the device with main.hex and tries to read the configuration bytes from the hex file.
sudo ./pic24f 0x3F7F 0xF9DF => This programs the device with main.hex and writes 0x37FF as Config#1 and 0x79DF as Config#2.
Currently the programmer is compatible with only those devices:
"PIC24FJ16GA002", "PIC24FJ16GA004", "PIC24FJ32GA002", "PIC24FJ32GA004", "PIC24FJ48GA002", "PIC24FJ48GA004", "PIC24FJ64GA002", "PIC24FJ64GA004", "PIC24FJ64GA006", "PIC24FJ64GA008", "PIC24FJ64GA010", "PIC24FJ96GA006", "PIC24FJ96GA008", "PIC24FJ96GA010", "PIC24FJ128GA006", "PIC24FJ128GA008", "PIC24FJ128GA010"
Pinout between the Little Wire and the pic24f is like below:
pin2 -> MCLR
pin4 -> PGC
pin1 -> PGD
I might try to update the program such that it doesn’t require any other hardware than GPIOs of the Raspberry Pi.
Here is the video of an example ‘blinky’ program uploading :) Sorry for the bad quality and the quicktime. If you can’t see the video, you can download here.
- Actually this blog post applies to any Linux installed computer.
- This application has not been tested extensively with all the devices listed, please aware of it and also if you test it please let me know!
- This programmer is almost 10 times slower than a Pickit and doesn’t support program reading and verification. Therefore, don’t think to use it as a main programmer for big projects. This might be suitable for uploading a bootloader to a micro, developing a small application or occasional firmware flashing purposes.
I hope someone find this useful!