Difference between revisions of "Microchip PICkit2"
Uwe Hermann (talk | contribs) m |
(pinout, hardware/firmware/software constraints, links to vendor documents) |
||
Line 1: | Line 1: | ||
[[File:Microchip pickit2.png|thumb|right|Microchip PICkit2.]] | [[File:Microchip pickit2.png|thumb|right|Microchip PICkit2.]] | ||
The [ | The [https://www.microchip.com/DevelopmentTools/ProductDetails/pg164120 Microchip PICkit2] is a programmer/debugger for PIC microcontrollers, but it can also be used as a general purpose I/O device, virtual COM port, or 3-channel logic analyzer (up to 1MHz samplerate, 1024 samples memory depth, hardware/firmware trigger support). | ||
See [[Microchip PICkit2/Info]] for more details (such as '''lsusb - | See [[Microchip PICkit2/Info]] for more details (such as '''lsusb -v''' output) about the device. | ||
== Hardware == | == Hardware == | ||
Essential components: | |||
* Microchip PIC18F2550-I/SO | * Microchip PIC18F2550-I/SO | ||
* 24LC512 | * 24LC512 (2x) | ||
Pinout: | |||
* 1: Vpp programming voltage, gets provided by the PICkit, also MCLR, or "pin 0" (output only) in some vendor or external applications | |||
* 2: Vdd target supply voltage, can get sensed or provided by the PICkit | |||
* 3: Vss aka ground | |||
* 4: PGD, ICSP data, "channel 1" in pk2la, input or output, RX in the "UART tool" | |||
* 5: PGC, ICSP clock, "channel 2" in pk2la, input or output, TX in the "UART tool" | |||
* 6: AUX, "channel 3" in pk2la, input or output, fixed voltage threshold | |||
Hardware/firmware constraints: | |||
* Vdd '''must''' be powered (internally or externally) to detect voltages on input pins (see the "UART Tool" and "Logic Tool User Guide" documents) | |||
* (externally provided) Vdd can be in the 2.5V to 5.0V range | |||
* pins 4 and 5 can detect logic levels down to 2.5V families, pin 6 is fixed to 3.6V families (the user guide states unreliable detection for lower voltage levels, and ST characteristics) | |||
* in logic analyzer mode (including the phase which waits for the trigger condition) the device is unable to communicate to the PC, the user needs to press the button to cancel a pending acquisition if the trigger condition isn't seen | |||
== Photos == | == Photos == | ||
Line 25: | Line 43: | ||
TODO. | TODO. | ||
The PICkit2 can be used as a general purpose I/O device, where up to four pins are under software control, and can be either input or output pins with a user specified logic level. This mode is slow, and is intended for interactive use, or visualization of slowly changing signals. There is a logic analyzer mode, where a setup packet is sent to the device, then acquisition takes place under the device's control (and without communication to the PC), then acquired data gets uploaded to the PC and is available for visualization or processing. | |||
Trigger capabilities: Can trigger on high or low level, or rising or falling edge on any of pins 4, 5, and 6. There is an optional trigger count (trigger only takes effect after the specified condition was observed for the specified number of times). The relation of acquired data and the trigger position is adjustable (see the software paragraph below). | |||
Software constraints (vendor software, and pk2la which is modelled after the vendor software): | |||
The user can chose from six options where the trigger position shall reside: At (roughly) 10/50/90% within the display window's width of 1K samples (referred to as "keeps (just over) one division before/after the trigger"). Or data optionally gets displayed 1/2/3 windows worth after the trigger condition (referred to as "delay N windows"). This latter choice is especially useful due to the limited memory depth, it allows to e.g. trigger on the start of a frame yet inspect later bits in that frame while acquisition uses high enough a samplerate. This would not be possible if the trigger must be in the 1024 samples range that gets acquired and displayed. For repetitive waveforms users could even "piece together" multiple acquisitions and thus get recordings with some 4K samples length. | |||
The SETUP packet uses a 16bit value for the trigger position. The pk2la project maps the above six-values user choice to some magic values while their calculation is uncertain (gsi: can't spot a pattern in those values, they're not related to percentage values or sample counts). | |||
== Resources == | == Resources == | ||
* [https://www.microchip.com/DevelopmentTools/ProductDetails/pg164120 PICkit2 vendor's product page] | |||
* [http://ww1.microchip.com/downloads/en/DeviceDoc/51553E.pdf user manual], schematics in appendix B | |||
* [http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit%202%20Logic%20Tool%20User%20Guide.pdf Logic Tool User Guide] | |||
* The [http://sourceforge.net/projects/pk2-la/ pk2-la project] has basic protocol docs and a Python implementation. | * The [http://sourceforge.net/projects/pk2-la/ pk2-la project] has basic protocol docs and a Python implementation. | ||
Revision as of 10:17, 14 December 2018
The Microchip PICkit2 is a programmer/debugger for PIC microcontrollers, but it can also be used as a general purpose I/O device, virtual COM port, or 3-channel logic analyzer (up to 1MHz samplerate, 1024 samples memory depth, hardware/firmware trigger support).
See Microchip PICkit2/Info for more details (such as lsusb -v output) about the device.
Hardware
Essential components:
- Microchip PIC18F2550-I/SO
- 24LC512 (2x)
Pinout:
- 1: Vpp programming voltage, gets provided by the PICkit, also MCLR, or "pin 0" (output only) in some vendor or external applications
- 2: Vdd target supply voltage, can get sensed or provided by the PICkit
- 3: Vss aka ground
- 4: PGD, ICSP data, "channel 1" in pk2la, input or output, RX in the "UART tool"
- 5: PGC, ICSP clock, "channel 2" in pk2la, input or output, TX in the "UART tool"
- 6: AUX, "channel 3" in pk2la, input or output, fixed voltage threshold
Hardware/firmware constraints:
- Vdd must be powered (internally or externally) to detect voltages on input pins (see the "UART Tool" and "Logic Tool User Guide" documents)
- (externally provided) Vdd can be in the 2.5V to 5.0V range
- pins 4 and 5 can detect logic levels down to 2.5V families, pin 6 is fixed to 3.6V families (the user guide states unreliable detection for lower voltage levels, and ST characteristics)
- in logic analyzer mode (including the phase which waits for the trigger condition) the device is unable to communicate to the PC, the user needs to press the button to cancel a pending acquisition if the trigger condition isn't seen
Photos
See also this flickr set for more PCB photos of the device.
Protocol
TODO.
The PICkit2 can be used as a general purpose I/O device, where up to four pins are under software control, and can be either input or output pins with a user specified logic level. This mode is slow, and is intended for interactive use, or visualization of slowly changing signals. There is a logic analyzer mode, where a setup packet is sent to the device, then acquisition takes place under the device's control (and without communication to the PC), then acquired data gets uploaded to the PC and is available for visualization or processing.
Trigger capabilities: Can trigger on high or low level, or rising or falling edge on any of pins 4, 5, and 6. There is an optional trigger count (trigger only takes effect after the specified condition was observed for the specified number of times). The relation of acquired data and the trigger position is adjustable (see the software paragraph below).
Software constraints (vendor software, and pk2la which is modelled after the vendor software): The user can chose from six options where the trigger position shall reside: At (roughly) 10/50/90% within the display window's width of 1K samples (referred to as "keeps (just over) one division before/after the trigger"). Or data optionally gets displayed 1/2/3 windows worth after the trigger condition (referred to as "delay N windows"). This latter choice is especially useful due to the limited memory depth, it allows to e.g. trigger on the start of a frame yet inspect later bits in that frame while acquisition uses high enough a samplerate. This would not be possible if the trigger must be in the 1024 samples range that gets acquired and displayed. For repetitive waveforms users could even "piece together" multiple acquisitions and thus get recordings with some 4K samples length.
The SETUP packet uses a 16bit value for the trigger position. The pk2la project maps the above six-values user choice to some magic values while their calculation is uncertain (gsi: can't spot a pattern in those values, they're not related to percentage values or sample counts).
Resources
- PICkit2 vendor's product page
- user manual, schematics in appendix B
- Logic Tool User Guide
- The pk2-la project has basic protocol docs and a Python implementation.