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 CCS Technical Support

PIC16LF1455 ICSP programming using D+/D-

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
[email protected]



Joined: 18 Apr 2018
Posts: 5

View user's profile Send private message

PIC16LF1455 ICSP programming using D+/D-
PostPosted: Wed Apr 18, 2018 8:39 am     Reply with quote

Hi,

I am working on PIC16LF1455 microcontroller, with MPLAB X IDE v4.10 and CCS compiler (v5.062). The ICSP programming through RC0 and RC1 (pin 10 and 9) works fine. See the figure for the pinout.



Now I am trying to use RA0 and RA1 (pin 13 and 12, or D+ and D-). The datasheet says D+ / D- pins should be enabled for low voltage programming (LVP) mode. But I tried LVP model, I got following error message:

"The low voltage programming feature requires the LVP configuration bit to be enabled on the target device. Please enable this configuration bit and try the operation again."

But I have set the LVP on in the program, but no effect.

#pragma config LVP = ON

Any suggestions?

Perry
temtronic



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

View user's profile Send private message

PostPosted: Wed Apr 18, 2018 9:40 am     Reply with quote

Well I downloaded the datasheet and it's not crystal clear to me..though maybe cause I'm getting old ?..... I'd have thought in the 'ISP' section, they'd explain in detail how to use both methods.
It appears to me there are 2 methods of ICSP. 'Normal' (using HV) done on 99.44% of PICs and then 'LVP' which is not commonly used.
One problem is that you'll need to tell the programmer to do 'LVP' . Depending on the programmer that can be done in a pulldown window or, with PK3, you can have the actual program do it.
I've never acually used LVP in 2+ decades....
but...
have do a question
Why use the D+D- pins? I assume you're using this PIC as it has USB. If so you need to isolate the ICSP pins from the USB hardware and that could be tricky. Even using 'regular' PICs, I keep ICSP pins only for ICSP function as I was 'bit' once trying to use the pins for both ICSP and I/O use.
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Wed Apr 18, 2018 10:31 am     Reply with quote

You realise that you are going to have to program the LVP bit with the normal programmer _before_ you can use LVP to re-program the chip. The LVP bit cannot be set using LVP.

You also need to be very careful that the LVP lines are biased to ensure they do not come 'on' when the programmer is not attached.
Have a pull-up resistor on the ICSPCLK line.
[email protected]



Joined: 18 Apr 2018
Posts: 5

View user's profile Send private message

PostPosted: Thu Apr 19, 2018 1:46 am     Reply with quote

Thanks, Jay!

Using D+/D- pins can make the PCB simpler, no need to have an extra ICSP connector.
[email protected]



Joined: 18 Apr 2018
Posts: 5

View user's profile Send private message

PostPosted: Thu Apr 19, 2018 1:49 am     Reply with quote

Ttelmah wrote:
You realise that you are going to have to program the LVP bit with the normal programmer _before_ you can use LVP to re-program the chip. The LVP bit cannot be set using LVP.

You also need to be very careful that the LVP lines are biased to ensure they do not come 'on' when the programmer is not attached.
Have a pull-up resistor on the ICSPCLK line.


You mean I should program the PIC using HV, with #pragma config LVP = ON, then change to LVP, comment out #pragma config LVP = ON, and try again?
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Thu Apr 19, 2018 3:28 am     Reply with quote

No. You leave LVP on.

You have to have the LVP enabled, program this with the high voltage programmer, and then leave it enabled.

LVP cannot write the LVP bit. It has to be written with a high voltage programmer before LVP will work.
temtronic



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

View user's profile Send private message

PostPosted: Thu Apr 19, 2018 5:07 am     Reply with quote

re: Using D+/D- pins can make the PCB simpler, no need to have an extra ICSP connector.

hmm.. except as Mr. T points out you need to use HV ICSP at least once ! That means extra time, say 15 minutes per unit to attach to programmer, burn and confirm versus the cost of a 5 pin header. You also need the ICSP header, oopsy !!
Consider your time at $60 /hr (less than ANY tradersperson here). 15 minutes is $15, a 5 pin header is, at most, 15 cents. This might ba a case of 'penny wise- pound foolsh'.
I don't see this 'feature' being a good one from Microchip. It'd be nice to hear from a real user of it, perhaps the guy who 'thought it up', sounds good on paper but useful in the real World ? Mind you I still prefer 'big' PICs with lots of pins, memory and peripherals. Saving a days R&D $ ( 500-1000) can pay for a lot of the next 'bigger' PIC, especially when the client needs another LED !
Just food for thought.
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Thu Apr 19, 2018 8:27 am     Reply with quote

LVP on the D+/D- pins, is for 'reverse compatibility' only. For code that was fundamentally written for the older pre-USB chip.
If you use these pins for LVP you basically lose the USB ability of the chip.
You also lose the MCLR pin. This becomes permanently enabled as MCLR only.
Now you need GND, MCLR, D+, D- Four connections. Not exactly a major saving over the standard ICSP header....

I quote from a poster on the MicroChip site about LVP on the same chip:
Quote:

In my humble opinion LVP its only good when you have some board were one PIC is programmed by another one (firmware upgrades/updates) and don't want to add the extra hardware of a charge pump to it.
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