PDA

View Full Version : can't reprogram 12F615



Max Power
- 29th March 2013, 18:54
Hello,
I having a heck of a time reprogramming a board with a 12F615 on it. The first program will download and verify just fine. After that, there are errors in different program memory locations:
Address: 00000000 Expected Value: 00002851 Received Value: 00002810
Programming failed

I suspect that I need to use my pickit2 instead of my pickit3...but I've also tried an ICD2 and an ICD3. my pickit2 is back at home.

I read through this: (the 2nd post)
http://www.microchip.com/forums/m576596-print.aspx

and then I set my icsp data and clock pins to be inputs instead of outputs - I'm not using them for anything else, there is nothing connected to them except the programming header. Also, I put in the pause command early in the program.

I figured that had to be what was going on.. programmed a new chip with the modified code...but I still can't reprogram

here is the program. I've got a thermistor voltage divider coming into GP2 and I've got GP4 controlling a fet acting as a low side switch. 10K pullup on MCLR, and the 5 pin programming header, and thats it.



@ __CONFIG _CP_OFF & _WDT_OFF & _BOR_OFF & _MCLRE_ON & _PWRTE_OFF & _INTRC_OSC_NOCLKOUT & _IOSCFS_4MHZ

'CLEARWDT 'picbasic will insert watchdog clears throughout the program

' Hardware configuration
' ======================
PAUSE 1000

DEFINE OSC 4 'tell picbasic how fast the clock is

DEFINE ADC_BITS 10 ' Set number of bits in result (8, 10 or 12)
DEFINE ADC_CLOCK 3 ' Set clock source (rc =3)
DEFINE ADC_SAMPLEUS 50 ' Set sampling

ADCON0 = %10001000 'RIGHT JUSTIFIED, VDD reference
ANSEL = %00000100 'GP2 is analog



GPIO = 0 'pins are set low, BEFORE assigning output pins to be outputs

TRISIO.0= 1 '0 = output 'GPIO.0 = PIN7 (icsp DATA)
TRISIO.1= 1 'GPIO.1 = PIN6 (ICSP CLOCK)
TRISIO.2= 1 'GPIO.2 = PIN5 analog input
TRISIO.3= 1 'GP3 = input only 'GPIO.3 = PIN4
TRISIO.4= 0 'GPIO.4 = PIN3
TRISIO.5= 0 'GPIO.5 = PIN2



POWERSWITCH VAR GPIO.4

TESTLED VAR GPIO.5

ADvalue VAR WORD


Main:

ADCIN 2, ADvalue

IF ADvalue > 275 THEN

POWERSWITCH = 0
pause 200

POWERSWITCH = 1
pause 75

ELSE

POWERSWITCH = 1

ENDIF

goto Main 'loop back up to main

END

Max Power
- 29th March 2013, 19:36
pic is running at 3.3V

using PBP 2.6C (I know..upgrade!) inside MPlab8.7

mackrackit
- 29th March 2013, 19:47
Are you erasing the chip before re-programming?

Max Power
- 29th March 2013, 19:51
I hit erase, and it says

Erasing...
Erase device complete

but then I fail a blank check

Darrel Taylor
- 29th March 2013, 21:03
I think Max Power has a Min Power problem. :)

The 12F615 requires a minimum of 4.5V to do a "Bulk Erase".

melabs programmers have a "Low Voltage Erase" option that can "Row Erase" at lower voltages.
I'm not sure if you can do that with Microchip programmers.

If possible, power your circuit with 5V during programming.

The problem you thought you were having with ICSP pins in output mode only affects chips with MCLR disabled. You have MCLR enabled.

Max Power
- 29th March 2013, 21:22
Awesome. I think that was it. This board has a 3.3V switching power supply running the micro. I also have a 4.7V zener on the power supply output because I have seen some pretty wicked spikes at startup. I set the pickit3 to power the micro at 4.625V, with the main power disconnected and....
Programming...
Programming/Verify complete

Thanks for your help.. and happy easter!.. I know I will be much happier not having to worry about this anymore!