Welcome, Guest

Author Topic: Can't program PIC-P32MX  (Read 9413 times)

drmike

  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Can't program PIC-P32MX
« on: February 04, 2016, 05:40:32 AM »
I have used ICD3 to program Pinguino with no problems, but I'm having a lot of problems with the PIC-P32MX board.  The ICD3 can see the board, but does not seem to be able to erase it's memory:

Connecting to MPLAB ICD 3...
Firmware Suite Version.....01.28.92
Firmware type..............PIC32MX

Target detected
Device ID Revision = B4 B6

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x7ffff
configuration memory

Programming...
Program memory is not blank.
Failed to program device

I have tried several configuration bit setups with the latest one being as follows:

// DEVCFG2
#pragma config FPLLIDIV = DIV_2         // PLL Input Divider (2x Divider)
#pragma config FPLLMUL = MUL_20         // PLL Multiplier (20x Multiplier)
#pragma config FPLLODIV = DIV_1         // System PLL Output Clock Divider (PLL Divide by 1)

// DEVCFG1
#pragma config FNOSC = PRIPLL           // Oscillator Selection Bits (Primary Osc w/PLL (XT+,HS+,EC+PLL))
#pragma config FSOSCEN = ON             // Secondary Oscillator Enable (Enabled)
#pragma config IESO = ON                // Internal/External Switch Over (Enabled)
#pragma config POSCMOD = EC             // Primary Oscillator Configuration (External clock mode)
#pragma config OSCIOFNC = OFF           // CLKO Output Signal Active on the OSCO Pin (Disabled)
#pragma config FPBDIV = DIV_2           // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/2)
#pragma config FCKSM = CSECMD           // Clock Switching and Monitor Selection (Clock Switch Enable, FSCM Enabled)
#pragma config WDTPS = PS1048576        // Watchdog Timer Postscaler (1:1048576)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable (WDT Disabled (SWDTEN Bit Controls))

// DEVCFG0
#pragma config DEBUG = ON              // Background Debugger Enable (Debugger is disabled)
#pragma config ICESEL = ICS_PGx2        // ICE/ICD Comm Channel Select (ICE EMUC2/EMUD2 pins shared with PGC2/PGD2)
#pragma config PWP = OFF                // Program Flash Write Protect (Disable)
#pragma config BWP = OFF                // Boot Flash Write Protect bit (Protection Disabled)
#pragma config CP = OFF                 // Code Protect (Protection Disabled)

I have tried using the debug option too but get this error:

Target detected
Device ID Revision = B4 B6

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x7ff
boot config memory
configuration memory

Programming...
boot config memory
Address: ffffffff Expected Value: 0 Received Value: 0
Failed to program device

I have 3.3 Volts on the ICSP lines, so power seems ok.   When I first got the board it was running a program, and now that is gone.  So _something_ is sort of working.

Does anyone have any idea what to look for?

Thanks!
Mike

JohnS

  • Hero Member
  • *****
  • Posts: 1725
  • Karma: +33/-48
Re: Can't program PIC-P32MX
« Reply #1 on: February 04, 2016, 11:11:50 AM »
Sorry, no - but similar problems have been noted with MPLAB etc and e.g. PICkit3.

Some discussions are on TBS forum http://www.thebackshed.com/forum/forum_topics.asp?FID=16&PN=1

People often now reflash PIC32 chips using other ways and e.g. pic32prog (I don't know if it can directly use ICD3).

You could post an ICD3-ICSP thread there and someone may have ideas.

BTW if using MPLAB, try its utility called IPE - again TBS people will probably suggest that.

Also, you can use a Pinguino PIC32 (or even a Raspberry pi or an arduino device - I've used USBASPs) to program any PIC32

John
« Last Edit: February 04, 2016, 11:15:46 AM by JohnS »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1967
  • Karma: +50/-3
Re: Can't program PIC-P32MX
« Reply #2 on: February 04, 2016, 11:19:17 AM »
Hey,

I'd suggest to play with the different powering options. Try to adjust the voltage that you provide to the board from the ICD3 in the range from 3V to 3.6V (increment by 0.1V). Then test to power the board independently (not from the ICD3).


Then why are you setting the configuration bits manually in the code? What happens with the default configurations?

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

drmike

  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Re: Can't program PIC-P32MX
« Reply #3 on: February 04, 2016, 11:25:30 PM »
Thanks! That gives me some possible routes. I did not try using ICD to power it.

The defaults in MPLAB don't cover the Olimex board. I suspect clocking is wrong. One more thing to try would be just internal clock. If that works I can get my project going. It's just wasting hardware I don't like.
Mike

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1967
  • Karma: +50/-3
Re: Can't program PIC-P32MX
« Reply #4 on: February 05, 2016, 11:44:46 AM »
By the way it is quite common to have improper hardware connections between the board and the tool that you use. Quite often you can have the connections mirrored (1-6; 2-5; etc). Try that also.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

drmike

  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Re: Can't program PIC-P32MX
« Reply #5 on: February 05, 2016, 06:38:13 PM »
I would think it would not find the device, but I will definitely double check that too!  Hopefully this evening when I get home from work.

mjbauer

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
Re: Can't program PIC-P32MX
« Reply #6 on: February 06, 2016, 02:54:15 AM »
Are you using MPLAB.X? if not, might be worth a try. I'm guessing the problem is not hardware, or MCU config bits, but more likely IDE setup is incorrect. I don't use MPLAB, so can't advise, but MPLABX allows debug/prog tool to be set up to always erase the chip before programming, or not. Check that your ICD3 options are set up correctly. Also, I suggest try programming the chip with an existing hex file known to load properly on your target board. Hope this helps.




drmike

  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Re: Can't program PIC-P32MX
« Reply #7 on: February 06, 2016, 03:39:30 AM »
Hi folks,

I tried two things - the first was to change the options to the button.c example on the PIC-P32MX web page.  Did not work.  The second thing I tried was to use the MPLAB-X ICD3 to power the chip at 3.25 volts.  That worked!  So there is some kind of contention between the PC power and the source power brick I'm using.

It won't be convenient for debugging, but I can get the job done.  Thanks for all the hints.  I can get to work now!

Edit to add: I programmed a simple test, and with the debugger it ran.  When I tried my power supply, it did not.  Further investigation shows the input AC protection diode drops are too much - I only have 3.5 Volts at the LM1117, which is not enough.  So it lights the LED, but it does not have enough voltage to run the processor.

Easy to fix, but I think power is the fundamental source of my problem!

Mike
« Last Edit: February 06, 2016, 04:18:12 AM by drmike »

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1967
  • Karma: +50/-3
Re: Can't program PIC-P32MX
« Reply #8 on: February 08, 2016, 02:12:23 PM »
Interesting.

Thank you for the update, it would be helpful for people with similar issue.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex