CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

PIC24EP512GP806 - Use port B w/programmer connected [CLOSED]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 493
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PIC24EP512GP806 - Use port B w/programmer connected [CLOSED]
PostPosted: Thu Nov 24, 2022 6:58 am     Reply with quote

Device: PIC24EP512GP806
Compiler: 5.026

Hi all,

This may sound like a trivial question but I've never really looked into it quite honestly.

I need to use a 16-bit port in input and the only two 16-bit ports on this PIC are port B and C.

I can't use port C because RC12/15 are used for the external oscillator (a 29.4912MHz oscillator).

As for port B, well B3/6/7 are used for the programmer. I want to leave the programmer connected while still be able to use the circuit after its been programmed. The device connected to port B will send it 16-bit data and I don't want this data to go to the programmer just like I don't want the programmer to send signals to the connected device.

What is the simplest way to achieve this with minimal parts? I was thinking of using low drop-out schottky diodes but this will lower the voltage a bit. I don't think it will matter since most likely the voltage will still be in the acceptable range but perhaps someone has a better solution.

Thanks,

Ben


Last edited by benoitstjean on Fri Nov 25, 2022 7:32 am; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 8573
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 24, 2022 7:11 am     Reply with quote

Microchip has ( had ??) an AB on using ICSP and 'stuff' connected to those pins....yeah, decades ago but I bet it's still there..

In the early years (think 16C84..) I recall using a 4PDT toggle switch. 100% isolation,no voltage drop or other 'weird' stuff....
4th pole fed 2 LED ..red for pgming, grn for go (running)

course this was back in the wirewrap dayze with PLENTY of room for parts...
alan



Joined: 12 Nov 2012
Posts: 338
Location: South Africa

View user's profile Send private message

PostPosted: Thu Nov 24, 2022 9:55 am     Reply with quote

Programming are not on C12/C15

Quote:
PGEC2/SOSCO/C3IN1-/T1CK/RPI62/RC14
PGED2/SOSCI/C3IN3-/RPI61/RC13
Ttelmah



Joined: 11 Mar 2010
Posts: 18225

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 6:20 am     Reply with quote

Realistically, as jay says, a switch is the only reliable and simple way to do
this.
The actual data pin for programming is bi-directional, so not easy to do
with diodes. You have three pins involved, PGEC, PGED & MCLR.
MCLR really needs to be disconnected from the normal reset circuit. The
programmers normally do not like it if this is pulled up by anything more
aggressive than perhaps 20KR, and certainly do not like a capacitor on
this pin. PGC is only an input to the PIC, so could probably be handled by
some sort of diode setup, depending on what you are using the pin for.
PGD is the data pin and is used for both input and output, so a physical
switch is by far the easiest way to do this. Many of the old prototype
boards just had jumpers that you could move to change the pin use.
Physically disconnecting with a switch also removes the possibility of
damaging the programmer.
Now because the chip supports moving the pins to different locations, they
are called PGECx and PGEDx. Why not just use the alternate pins?. You
are already avoiding port C, so use C13 & C14. You can use any pair of
the PCEC and PGED pins for programming. If you want to use them for
ICD, you have to specify which pair you are using with the ICSP=x
setting in the code.
You have the choice to use B6/B7, C13/C14, or B0/B1.

On MCLR, look at section 2.4 of the data sheet. Note how it shows a
jumper being used to disconnect the capacitor.
benoitstjean



Joined: 30 Oct 2007
Posts: 493
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 7:31 am     Reply with quote

Hi guys, ok thanks. Dip switches is the route I will take if I realize that what I am trying to accomplish is not feasible with my current setup.

Thanks!

Ben
temtronic



Joined: 01 Jul 2010
Posts: 8573
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 9:31 am     Reply with quote

One possible problem if you don't get the isolation correct, is what happens to whatever is connected to the I/O pins, say during programming.

PGMMING Clock and data could get transferred to relays or valves causing no end of 'fun'..... Smile
newguy



Joined: 24 Jun 2004
Posts: 1821

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 10:39 am     Reply with quote

Ttelmah wrote:
....MCLR really needs to be disconnected from the normal reset circuit. The programmers normally do not like it if this is pulled up by anything more aggressive than perhaps 20KR...


My standard ICSP interface has a 4.7k PU on the /MCLR line: no issues whatsoever with either an ICD-U64 nor a load-n-go.
PCM programmer



Joined: 06 Sep 2003
Posts: 21674

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 1:58 pm     Reply with quote

The Microchip documents for programmers show these pullup sizes:

ICD4 - 10K
ICD3 - 4.7K to 10K typical

PicKit4 - 10K to 50K
PicKit3 - 50K typical
newguy



Joined: 24 Jun 2004
Posts: 1821

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 2:01 pm     Reply with quote

Actually, we also use an ICD4 with a 4.7k PU on /MCLR with no ill effects.
Ttelmah



Joined: 11 Mar 2010
Posts: 18225

View user's profile Send private message

PostPosted: Fri Nov 25, 2022 11:14 pm     Reply with quote

Theree used to be a problem years ago, with one of the ealy programmers
not being able to handle <20K. Microchip at that time recommended 22K.
I've seen some problems even more recently when you go much lower.
So I prefer to keep the presented resistance high.
Remember on really old chips, the Vpp on MCLR, went up to over 20v.
If you used 4.7KR on these the programmer had to deliver about 5mA.
Also on small boards this could result in the actual supply rail being drawn
up.
So for modern chips using low voltages to program, 4.7K is OK. But on
old chips, you need to use much higher resistance values.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group