Changes

Jump to: navigation, search

PIC

1,330 bytes added, 21:16, 18 February 2015
Added some debugging info
==Compiling Code==
MPLAB is the IDE recommended by the ECE department. It can be run inside a Virtual Machine, programming using USB passthrough. It can also be installed under wine and the compiler used from the commandline. [http://sdcc.sourceforge.net/index.php sdcc] is a GPL C compiler with some support for PIC devices. Some GNU utilities (namely the assembler and linker, but not compiler) have been modified to support Microchip's microprocessors as part of the [http://gputils.sourceforge.net/ gputils project]. [http://piklab.sourceforge.net/ Piklab] is an IDE with support for both open source toolchains.
 
MPLABX, the current version of MPLAB, runs natively under Linux.
===Using Wine to Run the Toolchain===
==Programming==
See the [[PICKit 2]] article for programming your hex file natively using <code>pk2cmd</code>. The PICKit 3 has superceded the PICKit 2 but is lacking certain features. ==Debugging Hardware==Reading printf-style debugging messages over UART with the [[PICKit 2]] is possible from a Windows virtual machine with USB passthrough.
==Debugging=I2C===here's a variety of useful hardware available for debugging I2C:Reading printf* The [http://www.totalphase.com/products/aardvark-style debugging messages i2cspi/ Aardvark I2C/SPI Host Adapter] is capable of acting as either an I2C master or slave and reading and writing data over UART with USB. There is an [https://aur.archlinux.org/packages/aardvark-gui/ AUR package] for the Aardvark GUI for 32-bit machines. VTLUUG [https://vtluug.org/files/aardvark/ mirrors] other Aardvark files since they are no longer available on the PICKit 2 is possible from vendor's website. The Aardvark also works well in a Windows virtual machine VM with USB passthrough.* A [[Raspberry Pi]] has two onboard I2C buses and should be able to act as a master or slave. Performance and reliability may be suboptimal.* A [[Bus Pirate]] can act as an I2C master or slave and is suitable for human-speed interaction.
===UART===
UART can easily be debugged using an RS232 and a level shifter in the [https://en.wikipedia.org/wiki/MAX232 MAX232] family. For computers without hardware serial ports, USB to serial adapters have near-universal Linux support. For a simpler hardware setup, it may be desirable to use a Bus Pirate or Raspberry Pi as they both support 3v3 CMOS-level UART.
==External Links==
* [http://hackaday.com/2010/11/03/how-to-program-pics-using-linux/ How-to Program PICs using Linux - Hackaday] (see article and comments)
Anonymous user

Navigation menu