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

CAN Driver with Internal Oscillator

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







CAN Driver with Internal Oscillator
PostPosted: Fri Nov 03, 2006 3:02 pm     Reply with quote

Hello-

I am trying to start the CAN Controller with the Internal Oscillator of the PIC18F4580 since my design doesn't include an external crystal. When I run the program in CCS's development kit with the 20 MHz crystal, it works fine. When I change the PIC18F4580 to use the Internal RC with the PLL, the CAN output is not as expected. I have tested at several speeds (32MHz, 16MHz, 8MHz and 4MHz) and I have not been succesful. Note that for each microcontroller clock I have changed the baudrate prescalar in the can driver header file.

Have any tried running the CAN driver with th einternal oscillator? Am I missing something, or it is just impossible to use the internal oscillator? I have read that CAN clock must be very accurate.

Thanks for the help
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 03, 2006 3:49 pm     Reply with quote

The first test would be to use the same frequency for both the internal
oscillator and the external crystal. This would remove the possibility
of you doing incorrect calculations of bit timing parameters, for the
different frequencies.

In the following appnote, they go through several steps and calculate
the required oscillator tolerance for a particular example. They find
that the required tolerance is +/- 0.5 %.
http://www.freescale.com/files/microcontrollers/doc/app_note/AN1798.pdf
Other documents say it's possible to have up to +/- 1.5% tolerance.

The 18F4580 data sheets says the nominal tolerance of the INTRC
oscillator is +/- 1% at 25 deg. C. But over temperature it can be
up to 5% off.

Put this search string into Google, and you will find lots of appnotes on it:
"can bus" "oscillator tolerance"

Crystals are cheap. The ECS brand, in HC-49/US package is only $ .32
(US) each, in 1000 quantity ( http://www.digikey.com ). Most of the cost
sensitive manufacturers, such as motherboard makers, use this crystal
package. Even in hobbiest quantities, it's still cheap.
walat



Joined: 13 Mar 2013
Posts: 5

View user's profile Send private message Visit poster's website

External Osc. cheap but ...
PostPosted: Thu Apr 18, 2013 8:55 am     Reply with quote

by using PIC18f25K80 and ccs-c picc V4.134

first i communicate 4 node with 10Mhz external Osc. then i remove oscilators and use INTRC_IO and it WORK at 27C temp.

but what will be happend for more or less temp's i don't know
temtronic



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

View user's profile Send private message

PostPosted: Thu Apr 18, 2013 1:46 pm     Reply with quote

As PCM programmer says crystals are cheap !!! Decide what your time is worth, calculate how many hours you've been fighting this problem.
I'm betting you've cost yourself (or company) a LOT more than 32 cents!
In ANY project with time critical code (UARTS,SPI,CAN,etc) ALWAYS spend the extra buck up front for proper hardware.
I know of one project that worked great on the bench using the INTRC configuration, passed every test flawlessly....then...board went into a box and the temperature rose just a wee bit...and the system went 'erratic'. A 50 cent xtal solved the 'problem'.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Thu Apr 18, 2013 3:03 pm     Reply with quote

The classic line is 'read the data sheet'.

"As a rule of thumb, the bit timing requirements allow
ceramic resonators to be used in applications with
transmission rates of up to 125 Kbit/sec. For the full bus
speed range of the CAN protocol, a quartz oscillator is
required. A maximum node-to-node oscillator variation
of 1.7% is allowed"

Note the word 'required'.
The internal oscillator is _not_ accurate enough for CAN.
It sometimes can be used at low data rates, and at limited temperature ranges.

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Thu Apr 18, 2013 3:56 pm     Reply with quote

We're going through the same heartache with an externally sourced board that is mounted in a location that must stand temperature extremes. The board in question has a standard serial link to one of our boards. Our stuff has a crystal. The $300 externally sourced 1" x 1" board doesn't - not even a resonator. When things get really hot or really cold, we - gasp - lose the serial link.

I designed a drop in replacement (with a crystal this time that is actually spec'd to run over the entire temp range we see) and am just getting quotes to have them built. All quotes thus far are < $20 per.

And the supplier of the bad board can't figure out why we stopped buying them. Rolling Eyes
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Fri Apr 19, 2013 12:49 am     Reply with quote

Yes. It is also quite interesting how many 'off the shelf' USB devices fail if you take them outside 'room temperature'. Something in excess of 60% of standard USB hubs, won't work if you take them down to 0C. The reason is that the manufacturers elected to use ceramic resonators, rather than crystals.
Even in the 'room temperature' environment, when temperatures get high in the UK (when sometimes we have a summer), again large numbers of failures. We particularly tend to suffer with this because temperatures over 30C are very rare, and most countries where higher temperatures are common have air conditioning, while here very few people do....

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Fri Apr 19, 2013 8:45 am     Reply with quote

TTelmah,

Thank you for inadvertently alerting me to something I have to watch for. We're in the design stage of the 3rd gen of our main product. It has to endure -40C to +125C (some of it does anyway), and our "human portal" is going to have USB capability. We were planning to throw a USB hub in to allow all the USB devices we plan to have. It never occurred to me that a USB hub would have such a narrow temp range.

You wouldn't by chance know the manufacturers of the "good" ones?
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Fri Apr 19, 2013 11:32 am     Reply with quote

Look for industrial units (particularly ones designed to go on DIN rails). For non rail mounted units 'Amplicon' Uport 404 or 407. Ulink, SMSC, and several other manufacturers do 'i' rated units, but they usually have a distinct part number from the standard units.

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Fri Apr 19, 2013 12:19 pm     Reply with quote

Thanks!
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