microcontrollers:pic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
microcontrollers:pic [2022/01/23 19:10] – Embedded development on FreeBSD is easy ChristosMargiolismicrocontrollers:pic [2022/01/23 22:55] (current) – Avoid unnecessary erase if chip is blank TrevorRoydhouse
Line 17: Line 17:
 ''%%/usr/local/share/sdcc%%'' ''%%/usr/local/share/sdcc%%''
  
-For programming the MCU, I've found ''%%pk2cmd%%'' to work alright with PICKit2, +For programming the MCU, I've found ''%%pk2cmd%%'' to work well with the Microchip PICKit2 programmer (or Chinese clones), 
-but there's no port for %%FreeBSD%% anymore. The Makefile won't install +but there's no port for %%FreeBSD%% anymore. The Makefile won't install files properly, so we have some extra work to do afterwards:
-files properly, so we have some extra work to do afterwards:+
  
 <code> <code>
Line 33: Line 32:
  
 ===== Detecting and programming the MCU ===== ===== Detecting and programming the MCU =====
 +
 +:!: AUTO-DETECT WARNING: Always select the device family BEFORE connecting the chip to limit the maximum VPP that the PICkit 2 applies to the chip. Otherwise you risk damaging the chip and spending an inordinate amount of time trying to resolve issues with what is now a damaged chip.
 +
 +To avoid damage to chips by VPP voltage levels above that rated for the chip the recommended method for auto detection is:
 +
 +1) Get and cache a list of supported devices and families with
 +-?P
 +2) Get and cache a list of auto detectable families and IDs with
 +-PF
 +3) Use 1 and 2 to determine the family ID for a given part. Auto detect the chip using -PFn where n is the family ID.
 +
 +The //better option// is to avoid auto-detect altogether and specify the chip part number (eg PIC16F877A).
  
 Assuming you've wired the MCU and the programmer correctly, hook up Assuming you've wired the MCU and the programmer correctly, hook up
-the programmer to your computer and try to auto-detect the board. If +the programmer to your computer and check the chip is blank. If not erase the chip. 
-any of the following ''%%pk2cmd%%'' commands fail, make sure everything really is+ 
 +If any of the following ''%%pk2cmd%%'' commands fail, make sure everything really is
 wired properly: wired properly:
  
 <code> <code>
-$ pk2cmd -P +$ pk2cmd -P PIC16F877A -C 
-Auto-Detect: Found part PIC16F877A. +Device is blank
 Operation Succeeded Operation Succeeded
 </code> </code>
Line 54: Line 65:
 </code> </code>
  
-Erase the PIC and flash the new code. Again, use the appropriate names:+Erase the PIC (if the blank check failed) and flash the new code. Again, use the appropriate names:
  
 <code> <code>
Line 72: Line 83:
 Operation Succeeded Operation Succeeded
 </code> </code>
 +
 +----
 +
 +{{tag>HowTo}}
  
  • microcontrollers/pic.1642965032.txt.gz
  • Last modified: 2022/01/23 19:10
  • by ChristosMargiolis