Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| microcontrollers:pic [2022/01/23 19:10] – Embedded development on FreeBSD is easy ChristosMargiolis | microcontrollers:pic [2022/01/23 22:55] (current) – Avoid unnecessary erase if chip is blank TrevorRoydhouse | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| '' | '' | ||
| - | For programming the MCU, I've found '' | + | For programming the MCU, I've found '' |
| - | but there' | + | but there' |
| - | files properly, so we have some extra work to do afterwards: | + | |
| < | < | ||
| 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 programmer to your computer and check the chip is blank. If not erase the chip. |
| - | any of the following '' | + | |
| + | If any of the following '' | ||
| wired properly: | wired properly: | ||
| < | < | ||
| - | $ pk2cmd -P | + | $ pk2cmd -P PIC16F877A |
| - | Auto-Detect: Found part PIC16F877A. | + | Device is blank |
| Operation Succeeded | Operation Succeeded | ||
| </ | </ | ||
| Line 54: | Line 65: | ||
| </ | </ | ||
| - | Erase the PIC and flash the new code. Again, use the appropriate names: | + | Erase the PIC (if the blank check failed) |
| < | < | ||
| Line 72: | Line 83: | ||
| Operation Succeeded | Operation Succeeded | ||
| </ | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | {{tag> | ||