View previous topic :: View next topic |
Author |
Message |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Impossible to program 18F66K22 with 5 Vdc !!! ? |
Posted: Sat Apr 09, 2016 7:05 am |
|
|
Hello,
I use to many of the onboard 3.3V powered 18F66K22 application.
Today a new application for the 18F66K22 must be supplied with 5 V.
I use the CCS ICD U64
Software 5.024
Firmware 3.14
Hardware REV 2 (PID 194)
for program 18 F66K22.
CCS REV 5.056
IMPOSSIBLE TO PROGRAM 18F66K22 with 5 volts !!! ?
Error : Download Failed
With the same test program 1 X LED flashing and power DC of 3.3V the program works perfectly.
With power 5 volts the program does not work.
The feeds were checked properly .. no noise.
As a precaution I replaced the 18F66K22 unsuccessful.
I also changed ICD U64 and the cable
Welcome to the suggestions
About the FUSES :
Code: | #device adc=12
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
//#FUSES INTRC //Internal RC Osc
//#FUSES NOBROWNOUT //No brownout reset
//#FUSES BORV30 //Brownout reset at 2.7V
//#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES HSH //High speed Osc, high power 16MHz-25MHz
//!#FUSES BBSIZ1K //1K words Boot Block size
//!#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
//!#FUSES VREGSLEEP_SW
//!#FUSES SOSC_LOW
//! #use delay(crystal=20M)
//!#use delay(clock=20000000)
#use delay(int=16000000)
#use rs232(stream =gps,baud=9600, xmit=PIN_C6,rcv=PIN_C7)
#use rs232( stream=sigfox ,baud=19200, xmit=PIN_G1,rcv=PIN_G2)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)
|
Thanks in advance for your help |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Sat Apr 09, 2016 7:15 am |
|
|
these
//#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
//!#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
need to be enabled.
I'm using the 18F46K22 and have zero problems programming it at either +5 using a PICkit3
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
IMPOSSIBLE TO PROGRAM 18F66K22 with 5 Vdc !!! ? |
Posted: Sat Apr 09, 2016 7:29 am |
|
|
Thanks Temtronic for yours quick answer.
The 2 lines mentionned in your post was tested before.
I hace tried again but unfortunatly message is :
Error : Download Failed
..! ..? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19382
|
|
Posted: Sat Apr 09, 2016 7:54 am |
|
|
First thing is to get the chip clock fuses right.
You have HSH selectd (external oscillator), and the clock set as internal....
Then run CCSLOAD, and run the diagnostics. What does it say about the connection?.
Basic settings that should work:
Code: |
#include <PIC18F66K22.h>
#device adc=12
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Internal RC Osc
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(internal=16000000)
#use rs232(stream =gps,baud=9600, UART1)
#use rs232( stream=sigfox ,baud=19200, UART2)
#use i2c(Master,Fast=400000,I2C1)
//Includes should always be _after_ the corresponding hardware is setup
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
|
Obvious thing. You are changing the ENVREG pin?. The chip core is not rated to run above 3.6v. Above this you must have the Vreg enabled. The ENVREG pin must connect to Vdd. The Vcore pin, must not connect to Vdd, and needs good decoupling. More so, when running with the regulator.
Just tested this on an 86K22, (with the include changed) and it merrily programmed. |
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
IMPOSSIBLE TO PROGRAM 18F66K22 with 5 Vdc !!! ? |
Posted: Sat Apr 09, 2016 9:29 am |
|
|
Hi Telmah,
Thanks for your answer.
I did all your proposal change included ENVREG to 5V.
Result is :
0 Errors, 7 Warnings.
Build Successful.
CCSLOAD: Connecting
CCSLOAD: Programming PIC18F66K22
CCSLOAD: Error: Download Failed
Now if I put 3.3 V like power supply (after the 5V regulator) the message become :
--- All files up to date.
CCSLOAD: Connecting
CCSLOAD: Programming PIC18F66K22
CCSLOAD: Programming Complete
CCSLOAD: Target Running
......? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19382
|
|
Posted: Sat Apr 09, 2016 9:39 am |
|
|
So what does CCSload show in the diagnostics on the pins?. |
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
next |
Posted: Sat Apr 09, 2016 11:15 am |
|
|
Tested :
MCLR Vss Vdd Vpp the voltage move correctly
PGD also move correctly
PGC also '' ''
Target Device ID
Read : 11111111111xxxxx
Expect : 01010010110xxxxx |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19382
|
|
Posted: Sat Apr 09, 2016 11:27 am |
|
|
You have also removed the connection between Vcore and Vdd?.
This one is vital. Otherwise you will be over-voltaging the chip's core. |
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Brand new code (Wizard) 18F66K22 |
Posted: Sat Apr 09, 2016 11:33 am |
|
|
Yes to your question, one cap between Vcore and GND.
Test code tested with results identical (5 V and 3.3V).
I mean working with 3.3V, no working with 5V same error:
Code: |
#include <18F66K22.h>
#device ADC=16
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOBROWNOUT //No brownout reset
#use delay(internal=16000000)
#define LED PIN_G0
#define DELAY 1000
void main()
{
while(TRUE)
{
//Example blinking LED program
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
//TODO: User Code
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Important Message |
Posted: Sat Apr 09, 2016 11:52 am |
|
|
I saw the problem but I need to remove the chipset.
One track stay linked to Vcc below the package of 18F66K22
I will inform you as soon as possible of the result.
Thanks again for your Help |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19382
|
|
Posted: Sat Apr 09, 2016 12:39 pm |
|
|
That makes sense.
All the symptoms you had were of a chip trying to power from Vcc, rather than from the internal Vreg. Hence my little 'in circle' about the connections.
The board I have was designed to run from 5v, and programs fine. |
|
![](templates/subSilver/images/spacer.gif) |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
..... End with solution |
Posted: Sun Apr 10, 2016 3:31 am |
|
|
HI Ttelmah,
I'm agree with you. After hardware change like mentioned before
NO MORE PROBLEM
Programming the board with 5 Vdc power is now OK !
Thank for your help |
|
![](templates/subSilver/images/spacer.gif) |
|