View previous topic :: View next topic |
Author |
Message |
barkerben
Joined: 19 Jan 2006 Posts: 22
|
PIC18LF452 programming woes - ICSP |
Posted: Fri Jul 07, 2006 4:10 am |
|
|
Hi,
This has been asked before, but the answers were not conclusive...
I have a PIC18LF452 on a PCB that I'm programming via ICSP.
It runs off 3.3v, but is completely isolated during ICSP programming and powered via the programmer.
I can program, verify, erase, get chip info etc, erase, fine.
However, when I actually try to run the thing, nothing happens -the PIC seems not to be running. As a test, I am using a very simple debug script:
Code: |
#include <18F452>
#fuses HS,NOWDT,NOPUT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#define LED PIN_A5
void main() {
while (TRUE) {
output_high(LED);
delay_ms(500);
output_low(LED);
delay_us(500);
}
}
|
And my shcematic (EAGLE format) is at :
www.bbarker.co.uk/GPS8.sch
Does anyone have any ideas at all?
Cheers,
Ben
Last edited by barkerben on Fri Jul 07, 2006 5:40 am; edited 1 time in total |
|
|
Ttelmah Guest
|
|
Posted: Fri Jul 07, 2006 5:14 am |
|
|
Try adding 'SETUP_ADC_PORTS(NO_ANALOG);' at the start of main.
On some compiler versions/chips, the analog ports default to enabled. A5, is an analog pin, so this might cause problems.
Well done in posting a _simple_ program. However it'll look a lot nicer, if you use the 'code' buttons in future.
Best Wishes |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 5:38 am |
|
|
I'll try that this evening when I get home, and let you know - thanks. I also tried the exact same program but using pin B0 instead of A5 with no better results however. I know B0 is an interrupt pin, but is there any reason that shouldn't have worked?
Cheers,
Ben |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 6:24 am |
|
|
...what seems strange is that I can, apparently, program the thing. Iassume that I wouldn't be able to upload code, verify it, etc, if the programmer couldn't talk to the PIC. Hmmm.... |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Jul 07, 2006 7:02 am |
|
|
Running the 18LF452 with 3.3V at @20Mhz simultaneously it is close to the boundary spec.
You have two choices:
1) Increase the 3.3V
2) Use a lower frequency xtal.
Humberto
Last edited by Humberto on Fri Jul 07, 2006 7:14 am; edited 1 time in total |
|
|
Charlie U
Joined: 09 Sep 2003 Posts: 183 Location: Somewhere under water in the Great Lakes
|
|
Posted: Fri Jul 07, 2006 7:13 am |
|
|
Humberto, I have rev B of the data sheet and in figure 22-2 there is a graph of voltage vs. clock frequency. At the bottom of the figure is a formula for the maximum clock frequency at a given voltage. Using this formula, 25MHz is the max clock at 3.3V. There may be a later data sheet that changes this, or an errata that I have missed.
Also, I would recommend changing NOPUT to PUT to enable the power up timer. This is needed to allow the oscillator to stabilize before you try to run the processor. I have no idea if this could cause a "lockup", but I always use it with crystals. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Jul 07, 2006 7:22 am |
|
|
Charlie U, you are right.
My advice was because once I had the same problem (18LF452) and I solved it using
another lower frequency crystal (16Mhz) so my conclusion was not run the LF series
so close to the average boundaries spec.
I´m agree with you regarding the PUT. Also I would add:
#FUSES BROWNOUT
#FUSES BORV27
I know that by default the NOBROWNOUT is setted by I preffer to be explicit.
Regards,
Humberto
Last edited by Humberto on Fri Jul 07, 2006 7:34 am; edited 1 time in total |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 7:33 am |
|
|
I will give the XTAL idea a go and see what happens. Having said that, on my prototype board, I aran a 18F452 (not the L version) and 3.3v and 20Mhz with no problem, which according to the data sheet shouldn't work, but did :-p
Ben |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 11:48 am |
|
|
Hmm... none of those suggestions had an effect (including changing from 20 Mhz to 10)
What I can't work out is how I can program it, but not run it...I would have thought the two went together.
The only possible problem I can see is the jumper that is moved between programming mode and run mode to isolate the pic, but there is very little to go wrong there...
Ben |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Jul 07, 2006 12:20 pm |
|
|
Have you looked with an oscilloscope, post programming, to see if your oscillator is running? _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 07, 2006 12:29 pm |
|
|
Quote: | It runs off 3.3v, but is completely isolated during ICSP programming and powered via the programmer. |
Did you remove the isolation after programming ?
Do you have a 10K resistor going from the MCLR pin to +3.3v ?
Check the voltage on the MCLR pin to verify that the PIC isn't being
held in reset.
Also, there are two programming modes: Debugger and Standalone.
You didn't say what IDE you're using, but if it's MPLAB, there are
separate menus for each of those modes. In the menu bar at the
top of the main window, there are separate menus for "Debugger"
and "Programmer". For standalone mode, you need to use the
"Programmer" menu. |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 12:46 pm |
|
|
I havent checked the xtal - that would be a good idea. I don't have access to a scope here, but might get a chance later.
I have definately removed the isolation after programming, and checked the voltages on the important pins as well as I can. The MCLR pin is tied to 3.3v through a 22k resistor. I will try to recheck them all.
The PIC is in a TQFP 44 pin package, which makes checking pins tricky...
I'm using a IDE from Quasar electronics, although I beleive it was originally written by Kitrus.com. It has worked very well so far using the ZIF socket - I have never tried using it with ICSP. I have a feeling it is not compatible with MPLB. However, it has no option for configuring ICSP mode that I can see, other than selecting it. So it could be an IDe problem, but it is certainly working to some extent - it recognises the PIC, and notices if it is removed... |
|
|
Guest
|
|
Posted: Fri Jul 07, 2006 1:38 pm |
|
|
Ok... I have checked all of the pins, and when running all voltages are where they should be. I havent checked the xtal due to lack of scope :-)
The only obvious answer is that I am correctly programming it, but programming it with garbage - that would seem compatible with the programmer seeing the PIC and verifying the code, but still failing would it not?
Or perhaps the PIC tself was in some way damaged during soldering... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 07, 2006 1:43 pm |
|
|
I don't know. You're using an unknown programmer and IDE.
If you were using CCS or MPLAB, we could easily help. You need
to provide links to the websites for the programmer and IDE. |
|
|
barkerben
Joined: 19 Jan 2006 Posts: 22
|
|
Posted: Fri Jul 07, 2006 2:23 pm |
|
|
I realise I am asking for trouble with the programmer I'm using :-)
The website of the device is:
http://www.quasarelectronics.com/3128.htm
I am using CCS compiler version 3.231 to create the hex files, and the software proveded with the above programmer to upload it. It could be the hardware that is at fault, but I would rather not upgrade without knowing. I may be able to borrow someones ICD2 to try uploading the code...
Cheers,
Ben |
|
|
|