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

Impossible to program 18F66K22 with 5 Vdc !!! ?

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



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

Impossible to program 18F66K22 with 5 Vdc !!! ?
PostPosted: Sat Apr 09, 2016 7:05 am     Reply with quote

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

Embarassed 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
temtronic



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

View user's profile Send private message

PostPosted: Sat Apr 09, 2016 7:15 am     Reply with quote

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
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

IMPOSSIBLE TO PROGRAM 18F66K22 with 5 Vdc !!! ?
PostPosted: Sat Apr 09, 2016 7:29 am     Reply with quote

Smile 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

..! ..?
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Sat Apr 09, 2016 7:54 am     Reply with quote

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.
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

IMPOSSIBLE TO PROGRAM 18F66K22 with 5 Vdc !!! ?
PostPosted: Sat Apr 09, 2016 9:29 am     Reply with quote

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

......?
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Sat Apr 09, 2016 9:39 am     Reply with quote

So what does CCSload show in the diagnostics on the pins?.
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

next
PostPosted: Sat Apr 09, 2016 11:15 am     Reply with quote

Tested :

MCLR Vss Vdd Vpp the voltage move correctly
PGD also move correctly
PGC also '' ''

Target Device ID
Read : 11111111111xxxxx
Expect : 01010010110xxxxx
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Sat Apr 09, 2016 11:27 am     Reply with quote

You have also removed the connection between Vcore and Vdd?.

This one is vital. Otherwise you will be over-voltaging the chip's core.
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

Brand new code (Wizard) 18F66K22
PostPosted: Sat Apr 09, 2016 11:33 am     Reply with quote

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
   }

}
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

Important Message
PostPosted: Sat Apr 09, 2016 11:52 am     Reply with quote

Embarassed

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Sat Apr 09, 2016 12:39 pm     Reply with quote

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. Very Happy

The board I have was designed to run from 5v, and programs fine.
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

..... End with solution
PostPosted: Sun Apr 10, 2016 3:31 am     Reply with quote

HI Ttelmah,

I'm agree with you. After hardware change like mentioned before

NO MORE PROBLEM Very Happy Surprised

Programming the board with 5 Vdc power is now OK !

Thank for your help
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