Author Topic: Re: PIC24F + Pickit3 Connectivity  (Read 5972 times)

0 Members and 1 Guest are viewing this topic.

Offline netwinderTopic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: ca
Re: PIC24F + Pickit3 Connectivity
« on: July 06, 2016, 11:55:28 pm »
Hello EEVBlog fourm,

Recently I decided to start a new project. The fine details of what the project needs to do aren't necessary as the issue here is just connecting to the chip in question. I am using a PIC24FJ32MC101, and here is the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/30009997e.pdf

Here's my problem (it sounds simple, i'm just new to this) I can connect every pin of my PICkit3 to it except for PGD (ICSPDAT) and PGC (ICSPCLK). On the datasheet I can't find the connections, and doing a ctrl+f search of the datasheet yields nothing in regards to PGD, ICSPDAT, PGC and ICSPCLK.

I guess there's some other way to connect to this chip, what is it? Either that or I'm just blind and can't see the connections on the diagram (im fairly certain they are not there).

If you're curious, my project involves some bluetooth interfacing with this bluetooth module (http://www.digikey.ca/product-detail/en/seeed-technology-co-ltd/317030001/1597-1359-ND/5487659) and this chip has UART, so I hope to use it.

However I need to connect to the chip first - thanks for your time!
« Last Edit: July 06, 2016, 11:57:44 pm by netwinder »
 

Offline ludzinc

  • Supporter
  • ****
  • Posts: 506
  • Country: au
    • My Misadventures In Engineering
Re: PIC24F + Pickit3 Connectivity
« Reply #1 on: July 06, 2016, 11:59:17 pm »
Read section 2.5 ICSP Pins.

You have the option of multiple  PGECx and PGEDx pins for clock and data. 
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Re: PIC24F + Pickit3 Connectivity
« Reply #2 on: July 07, 2016, 12:11:50 am »
PGC/ICSPCLK goes to PGECn and PGD/ICSPDAT goes to PGEDnn must be the same (1 to 3), you cant split the pin pairs.  Additionally, for debugging to work, you have to make sure that the chip is configured to use the correct pin pair using #pragma config ICS.  This setting is only for debugging and does NOT affect programming.
 

Offline netwinderTopic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: ca
Re: PIC24F + Pickit3 Connectivity
« Reply #3 on: July 07, 2016, 12:22:37 am »
Ok, I tried that. I have pin 5 (PGEC1) connected to PGC and pin 4 (PGED1) connected to PGD. When I try and establish a connection in MPLAB IPE,

*****************************************************

Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.43.35
Firmware type..............dsPIC33F/24F/24H

Programmer to target power is enabled - VDD = 3.250000 volts.
Target Device ID (0x0) is an Invalid Device ID. Please check your connections to the Target Device.

What am I doing wrong? Thanks for the quick replies  :D
 

Offline Maxlor

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: PIC24F + Pickit3 Connectivity
« Reply #4 on: July 07, 2016, 12:28:06 am »
Maybe you forgot the pullup on MCLR?
 

Offline netwinderTopic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: ca
Re: PIC24F + Pickit3 Connectivity
« Reply #5 on: July 07, 2016, 12:34:13 am »
Tried that. I tried a few configurations, including the one presented in the datasheet.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Re: PIC24F + Pickit3 Connectivity
« Reply #6 on: July 07, 2016, 12:34:26 am »
Have you got both Vss pins connected with a 0.1uF ceramic decoupling cap across the Vdd,Vss pin pair and a 10uF 16V Tantalum from Vcap to Vss?  It wont work with poor decoupling.   Also, at least initially, reserve the ICSP pin pair you've chosen and also /MCLR for programming/debugging only.  Don't try to share them with your application circuit.

It shouldn't need a /MCLR pullup for programming/debugging, but a 10K one would be advisable for standalone running.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC24F + Pickit3 Connectivity
« Reply #7 on: July 07, 2016, 12:45:16 am »
read the datasheet section on power supply / minimum connection and compare it to your setup.
================================
https://dannyelectronics.wordpress.com/
 

Offline netwinderTopic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: ca
Re: PIC24F + Pickit3 Connectivity
« Reply #8 on: July 07, 2016, 01:00:47 am »
Thanks everybody! I did some testing and what i was missing was the tantalum capacitor going from vcap to ground.

I can start writing mediocre code now! Thanks for the help :)
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: PIC24F + Pickit3 Connectivity
« Reply #9 on: July 07, 2016, 08:43:58 pm »
FWIW, for future reference this is the blinky sanity check code I use for pretty much every PIC24F/E and dsPIC33F/E chip.

Code: [Select]
#pragma config OSCIOFNC = OFF           // CLKO Enable Configuration bit (CLKO output signal is active on the OSCO pin)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
// Some DIP/SOIC/SSOP dsPIC33/PIC24s have pins 4&5 as PGD3 rather than PGD1, uncomment next line if so
//#pragma config ICS = PGD3               // ICD Communication Channel Select bits (Communicate on PGEC3 and PGED3)

#include <xc.h>

// FCY depends on the specific device's internal oscillator and default CLKDIV<10:8> bits
#define FCY 7370000/2 // All dsPIC33s, a few PIC24s
//#define FCY 8000000/4 // Most but not all PIC24s

#include <libpic30.h>

int main(void)
{
    TRISBbits.TRISB15=0;
    while (1)
    {
        LATBbits.LATB15=1;
        __delay_ms(250);
        LATBbits.LATB15=0;
        __delay_ms(250);
    }
    return 0;
}


... and here it is working on your device:


 

Offline netwinderTopic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: ca
Re: PIC24F + Pickit3 Connectivity
« Reply #10 on: July 07, 2016, 09:26:54 pm »
FWIW, for future reference this is the blinky sanity check code I use for pretty much every PIC24F/E and dsPIC33F/E chip.

Code: [Select]
#pragma config OSCIOFNC = OFF           // CLKO Enable Configuration bit (CLKO output signal is active on the OSCO pin)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
// Some DIP/SOIC/SSOP dsPIC33/PIC24s have pins 4&5 as PGD3 rather than PGD1, uncomment next line if so
//#pragma config ICS = PGD3               // ICD Communication Channel Select bits (Communicate on PGEC3 and PGED3)

#include <xc.h>

// FCY depends on the specific device's internal oscillator and default CLKDIV<10:8> bits
#define FCY 7370000/2 // All dsPIC33s, a few PIC24s
//#define FCY 8000000/4 // Most but not all PIC24s

#include <libpic30.h>

int main(void)
{
    TRISBbits.TRISB15=0;
    while (1)
    {
        LATBbits.LATB15=1;
        __delay_ms(250);
        LATBbits.LATB15=0;
        __delay_ms(250);
    }
    return 0;
}


... and here it is working on your device:




Wow, thank you very much for the example, the photo, and the schematic! I really appreciate the effort you put into the answer  :) I'll adjust my configuration to match yours
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: PIC24F + Pickit3 Connectivity
« Reply #11 on: July 07, 2016, 09:41:05 pm »
You'll see I enable CLKO in the #pragma config as a matter of course so you can see Fcy on the CLKO pin with a scope. It's personal preference, but there is no harm in having this available, and positively helps in debugging expecially in the very early stages of development. Configuring the oscillator is pretty much the second step after getting a blinky going.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13728
  • Country: gb
    • Mike's Electric Stuff
Re: PIC24F + Pickit3 Connectivity
« Reply #12 on: July 07, 2016, 09:58:47 pm »
Use a ceramic - cheaper than tantalum.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: PIC24F + Pickit3 Connectivity
« Reply #13 on: July 07, 2016, 10:21:51 pm »
Use a ceramic - cheaper than tantalum.

Agreed, for SMD and production, not forgetting any derating of value due to DC bias etc. Breadboarding, even crappy electroytics work well enough in practice, although I realise it's not recommended.
 

Offline old gregg

  • Regular Contributor
  • *
  • Posts: 130
  • Country: 00
Re: PIC24F + Pickit3 Connectivity
« Reply #14 on: April 01, 2022, 12:19:32 pm »
I want to use a PIC24EP32GP204 but I can't get past this :
Quote
Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.56.09
Firmware type..............dsPIC33E/24E

Target voltage detected
Target Device ID (0x0) is an Invalid Device ID. Please check your connections to the Target Device.

Device Erased...

Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x57ff
Failed to program device
Selected device and target: memory mismatch.

looks it is memory related , but quite not sure.

 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: PIC24F + Pickit3 Connectivity
« Reply #15 on: April 01, 2022, 01:02:55 pm »
I want to use a PIC24EP32GP204 but I can't get past this :
Quote
Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.56.09
Firmware type..............dsPIC33E/24E

Target voltage detected
Target Device ID (0x0) is an Invalid Device ID. Please check your connections to the Target Device.

Device Erased...

Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x57ff
Failed to program device
Selected device and target: memory mismatch.

looks it is memory related , but quite not sure.

The physical device you're targeting isn't the same as the one in the project's properties.
 

Offline old gregg

  • Regular Contributor
  • *
  • Posts: 130
  • Country: 00
Re: PIC24F + Pickit3 Connectivity
« Reply #16 on: April 01, 2022, 01:17:48 pm »
Quote
The physical device you're targeting isn't the same as the one in the project's properties.

I thought about this, but they actully are. It's written on the chip "PIC24EP32GP204-I/PT" , all from Farnell.

Code: [Select]
/opt/microchip/xc16/v1.70/bin/xc16-gcc"   pic24_test.c  -o build/default/production/pic24_test.o  -c -mcpu=24EP32GP204  -MP -MMD -MF
« Last Edit: April 01, 2022, 01:23:52 pm by old gregg »
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Re: PIC24F + Pickit3 Connectivity
« Reply #17 on: April 01, 2022, 01:31:01 pm »
Quote
Target Device ID (0x0)
fix this.

(PGC/PGD swapped, wrong MCLR circuit, insufficient vcap, ..)
 
The following users thanked this post: Howardlong

Offline old gregg

  • Regular Contributor
  • *
  • Posts: 130
  • Country: 00
Re: PIC24F + Pickit3 Connectivity
« Reply #18 on: April 01, 2022, 01:32:18 pm »
don't ask me what i've done...check and uncheck little boxes in menu :
Code: [Select]
Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.56.09
Firmware type..............dsPIC33E/24E

Target voltage detected
Target device PIC24EP32GP204 found.
Device Revision ID = 4008

Device Erased...

Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
configuration memory
Programming/Verify complete

Device Erased...

Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
configuration memory
Programming/Verify complete
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: Re: PIC24F + Pickit3 Connectivity
« Reply #19 on: April 01, 2022, 06:49:39 pm »
Quote
Target Device ID (0x0)
fix this.

(PGC/PGD swapped, wrong MCLR circuit, insufficient vcap, ..)

Doh, I should’ve seen that!
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14440
  • Country: fr
Re: PIC24F + Pickit3 Connectivity
« Reply #20 on: April 01, 2022, 07:48:19 pm »
Thanks everybody! I did some testing and what i was missing was the tantalum capacitor going from vcap to ground.

One other common issue on the PIC24F is to leave the AVdd pin unconnected (for the MCUs that have this pin.) That'll prevent ICSP from working properly.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: PIC24F + Pickit3 Connectivity
« Reply #21 on: April 01, 2022, 08:08:21 pm »
Thanks everybody! I did some testing and what i was missing was the tantalum capacitor going from vcap to ground.

One other common issue on the PIC24F is to leave the AVdd pin unconnected (for the MCUs that have this pin.) That'll prevent ICSP from working properly.

I missed the OP’s tant cap comment… I switched to MLC about a decade ago for Vcap and other semi bulk decoupling on PICs, cost isn’t prohibitive and they’re less likely to fail: when they do, it’s less likely to be catastrophic. Worth keeping in kind DC bias derating on ceramics. You can get 10uF ceramic in through hole too nowadays, pretty sure inside they’re just an SMD with leads attached.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf