View previous topic :: View next topic |
Author |
Message |
object01
Joined: 13 May 2004 Posts: 90 Location: Nashville, TN
|
PIC18F4620 support problems? Anyone? |
Posted: Tue Dec 14, 2004 11:32 am |
|
|
Before we upgrade from our PIC18F452 to a PIC18F4620, I wanted to poll the community about whether anyone's had good/bad experiences. CCS lists this part as "in beta test," but we've had good experiences with the 2620, which is listed the same way.
Anyone out there have any gripes about PIC18F4620 + CCS PCH & ICD?
--
Jeff S. |
|
|
Guest
|
452 to 4620 |
Posted: Tue Dec 14, 2004 8:18 pm |
|
|
To get my 4620 working with old 452 code, I made the following change for the CCS compiler:
1. Tools --> Device Editor --> 4620 --> UART --> ESCI --> FALSE (PCWH 3.212) or ESCI --> Standard (? for PCWH 3.214)
i.e. set it back to the UART mode of 452
2. comment out #zero_ram and do it myself
Otherwise CCS's 4620 code have problem with RS232 and LCD.
BTW, 4620's hardware ADC seems to be slightly different from 452, check it out if necessary.
Best wishes |
|
|
Ken Macfarlane
Joined: 04 Oct 2004 Posts: 12 Location: Glasgow, Scotland
|
I Agree |
Posted: Thu Dec 30, 2004 8:33 am |
|
|
I haven't been able to get a simple LCD app to port from 452 to 4620, and my ICD doesn’t work properly: a program that works on an 18f452, won’t reset on an 18f4620 in the same pcb. The ICD complains that it "can’t reset the target", and instructs to check mclr & the clk. From a scope, the clock was non-existant, but surely, if they were good enough for the 452, the clock osc. should have run for a 4620 in the same pcb.
p.s. when you say you #zeroed ram yourself, do you mean explicitly seeting every local to zero, or do you mean an assembler level set ram to 0 for "every register that might be used to hold variables" as it says in the manual i.e. which registers? |
|
|
Ken Macfarlane
Joined: 04 Oct 2004 Posts: 12 Location: Glasgow, Scotland
|
Ignore this |
Posted: Thu Dec 30, 2004 9:31 am |
|
|
this is just because I forgot to set the notify when a reply is posted flag |
|
|
Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
Some Info on the 4620. |
Posted: Fri Dec 31, 2004 9:25 am |
|
|
First off you need to have ICD firmware V 1.30 or higher if you are going to have a chance at all to get the ICD to work with the 4620.
I don’t know what compiler V you are using but ICD firmware V1.33 was supplied with compiler V3.213.
Second it does sound like that you main osc is not running. PIC are finicky at best when it comes to the oscillator drive. From my experience most all PIC chips are shipped with the OSC fuse set for LP. Some times this is not enough drive to get a fast crystal started. I have run in to this using ceramic resonator on the 16F series chips the most.
For example the target PCB will have a 20Mhz resonator on it and an ICD port. Put a new PIC16F8XX in it and it will not start to even get the first program loaded.
Remove the chip and put it on a test PCB with a slow crystal and program the chip with an OSC fuse setting of HS. Move the chip back to the target PCB and all is normal, the chip will program and run just fine from that point on in that PCB with the resonator.
Ok back to your issues.
First think that I would do is setup my program to run with out the ICD that is remove “#device ICD=TRUE”. Also there are one or two other thing that need to be removed from you program if you are using them. The two big ones are “#ZERO_RAM” and “#device WRITE_EEPROM=ASYNC”. The zero ram you can go back and working on write your own code for that when you get your program up and running if you have to have it. I have remove zero ram from all of my 2620 and 4620 programs and have not had an issues. The write eeprom async I have not been able to get to work on any PIC from the time CCS introduced it. Compile that program to a HEX file.
Run the stand alone ICD software and go to advanced and under read device click on Configuration this will read the fuse setting of the PIC. Note what the OSC setting are.
Now program the chip with your hex file and recheck the fuse setting and see if they have changed.
If the OSC setting did not change two things you can try are.
One rearrange the fuses in the program line i.e. move the OSC fuse to the end of the line and recompile and program test. This has worked one or two times for me in the pasted. I know it makes no sense but some times it works.
Two set the 4620 to use the internal oscillator block. You can do this by changing the OSC fuse to “INTRC_IO”. The 4620 will run slow but once you have it running you can change to the OSC fuse that you need for your crystal and reprogram for that crystal.
I hope this helps!
PS I have a number of 2620 and 4620 running in my projects.
They will run almost any code that the 452 will run.
Tom |
|
|
jcjneudo
Joined: 21 Feb 2005 Posts: 4
|
18F4620 gotchas |
Posted: Wed Feb 23, 2005 8:06 am |
|
|
There are a few gotchas with the 18F4620 that have slowed me down a bit.
1. The "XINST" flag is set by default on certain compiler versions. When I used v3.212, I lost several days because of this. Fixed in 3.219. Code like below can go into never-never land if the new instructions are enabled. The culperate seems to be things like line 0054, where the accumulator is moved to "06" (which is now indexed with the FSR2 register). I assume that the extra instructions just aren't supported at all.
2. 32MHz internal rc operation requires hand-tweaking of the OSCTUNE port.
3. Using CCS' ICD code (with Microchip ICD1) allows downloads but not debugging (the oscillator does not seem to be fully supported). Although perhaps given the previous post I should upgrade the ICD firmware again and retry.
Code: |
.................... while(1) {
.................... for(i=55 ; i; i++) {
0052: MOVLW 37
0054: MOVWF 06
0056: MOVF 06,F
0058: BZ 0070
.................... LATD ^= 0x80;
005A: MOVLW 80
005C: XORWF F8C,F
.................... delay_us(500);
005E: MOVLW 02
0060: MOVWF 07
0062: MOVLW FA
0064: MOVWF 08
0066: BRA 0004
0068: DECFSZ 07,F
006A: BRA 0062
.................... }
006C: INCF 06,F
006E: BRA 0056
.................... LATB ^= 0x01;
0070: MOVLW 01
0072: XORWF F8A,F
.................... }
0074: BRA 0052
.................... }
....................
0076: SLEEP
|
|
|
|
|