Re: PIC24F + Pickit3 Connectivity - Page 1
Forum section: electronics / general

author: netwinder
author_rank: Regular Contributor
timestamp: July 06, 2016, 11:55:28 pm
content: 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.pdfHere'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!

author: ludzinc
author_rank: Unknown
timestamp: July 06, 2016, 11:59:17 pm
content: Read section 2.5 ICSP Pins.You have the option of multiple PGECx and PGEDx pins for clock and data.

author: Ian.M
author_rank: Super Contributor
timestamp: July 07, 2016, 12:11:50 am
content: PGC/ICSPCLK goes to PGECnand PGD/ICSPDAT goes to PGEDn.nmust 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.

author: netwinder
author_rank: Regular Contributor
timestamp: July 07, 2016, 12:22:37 am
content: 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 3Firmware Suite Version.....01.43.35Firmware type..............dsPIC33F/24F/24HProgrammer 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

author: Maxlor
author_rank: Frequent Contributor
timestamp: July 07, 2016, 12:28:06 am
content: Maybe you forgot the pullup on MCLR?

author: netwinder
author_rank: Regular Contributor
timestamp: July 07, 2016, 12:34:13 am
content: Tried that. I tried a few configurations, including the one presented in the datasheet.

author: Ian.M
author_rank: Super Contributor
timestamp: July 07, 2016, 12:34:26 am
content: 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.

author: dannyf
author_rank: Super Contributor
timestamp: July 07, 2016, 12:45:16 am
content: read the datasheet section on power supply / minimum connection and compare it to your setup.

author: netwinder
author_rank: Regular Contributor
timestamp: July 07, 2016, 01:00:47 am
content: 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

author: Howardlong
author_rank: Super Contributor
timestamp: July 07, 2016, 08:43:58 pm
content: FWIW, for future reference this is the blinky sanity check code I use for pretty much every PIC24F/E and dsPIC33F/E chip.Code:#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:

author: netwinder
author_rank: Regular Contributor
timestamp: July 07, 2016, 09:26:54 pm
content: Quote from: Howardlong on July 07, 2016, 08:43:58 pmWow, thank you very much for the example, the photo, and the schematic! I really appreciate the effort you put into the answerI'll adjust my configuration to match yours

author: Howardlong
author_rank: Super Contributor
timestamp: July 07, 2016, 09:41:05 pm
content: 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.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: July 07, 2016, 09:58:47 pm
content: Use a ceramic - cheaper than tantalum.

author: Howardlong
author_rank: Super Contributor
timestamp: July 07, 2016, 10:21:51 pm
content: Quote from: mikeselectricstuff on July 07, 2016, 09:58:47 pmAgreed, 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.

author: old gregg
author_rank: Regular Contributor
timestamp: April 01, 2022, 12:19:32 pm
content: I want to use a PIC24EP32GP204 but I can't get past this :Quotelooks it is memory related , but quite not sure.

author: Howardlong
author_rank: Super Contributor
timestamp: April 01, 2022, 01:02:55 pm
content: Quote from: old gregg on April 01, 2022, 12:19:32 pmThe physical device you're targeting isn't the same as the one in the project's properties.

author: old gregg
author_rank: Regular Contributor
timestamp: April 01, 2022, 01:17:48 pm
content: QuoteI thought about this, but they actully are. It's written on the chip "PIC24EP32GP204-I/PT" , all from Farnell.Code:/opt/microchip/xc16/v1.70/bin/xc16-gcc" pic24_test.c -o build/default/production/pic24_test.o -c -mcpu=24EP32GP204 -MP -MMD -MF

author: JPortici
author_rank: Super Contributor
timestamp: April 01, 2022, 01:31:01 pm
content: Quotefix this.(PGC/PGD swapped, wrong MCLR circuit, insufficient vcap, ..)

author: old gregg
author_rank: Regular Contributor
timestamp: April 01, 2022, 01:32:18 pm
content: don't ask me what i've done...check and uncheck little boxes in menu :Code:Connecting to MPLAB PICkit 3...Currently loaded firmware on PICkit 3Firmware Suite Version.....01.56.09Firmware type..............dsPIC33E/24ETarget voltage detectedTarget device PIC24EP32GP204 found.Device Revision ID = 4008Device Erased...Programming...The following memory area(s) will be programmed:program memory: start address = 0x0, end address = 0x3ffconfiguration memoryProgramming/Verify completeDevice Erased...Programming...The following memory area(s) will be programmed:program memory: start address = 0x0, end address = 0x3ffconfiguration memoryProgramming/Verify complete

author: Howardlong
author_rank: Super Contributor
timestamp: April 01, 2022, 06:49:39 pm
content: Quote from: JPortici on April 01, 2022, 01:31:01 pmDoh, I should’ve seen that!

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 01, 2022, 07:48:19 pm
content: Quote from: netwinder on July 07, 2016, 01:00:47 amOne 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.

author: Howardlong
author_rank: Super Contributor
timestamp: April 01, 2022, 08:08:21 pm
content: Quote from: SiliconWizard on April 01, 2022, 07:48:19 pmI 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.