0

I got myself a crying, waking, sleeping, talking 18F2455

Posted by Chris on Monday, April 20, 2009 in , , ,
Yahoo! My 18F2455 chips arrived in the post this morning (8am can you believe?!)

And, ok, maybe they're not quite that sophisticated, with all the crying, walking stuff. To be honest, not one of them cries or walks or sleeps or talks. In fact not one of them does anything. Because I haven't programmed one yet.

The first thing I did was find out what type of settings I needed to use for the programmer and found that the internal oscillator for the 18F2455 needs to run at 6Mhz (or 48Mhz) if you're going to use USB. No problems so far - at least it has an internal oscillator. Then I read the spec for the USB port and it says:
"With PIC18F2455/2550/4455/4550 devices, the primary oscillator becomes part of the USB module and cannot be associated to any other clock source. Thus, the USB module must be clocked from the primary clock source; however, the microcontroller core and other peripherals can be separately clocked from the secondary or internal oscillators as before."

So whether you like it or not, you have to use an external crystal if you want to make use of the USB comms. The internal oscillator is either dedicated to the USB timing or the micro clock source - one or the other. Without USB, it is worth noting, that these chips have a wide range of internal oscillator values available - but if you're not using the USB comms, why use one of these chips and not some cheaper alternative??

Added into the mix is this statement:
"When the PIC18F4550 is used for USB connectivity, it must have either a 6 MHz or 48 MHz clock for USB operation, depending on whether Low-Speed or Full-Speed mode is being used....The USB clock for Low-Speed mode is derived from the primary oscillator chain and not directly from the PLL. It is divided by 4 to produce the actual 6 MHz clock. Because of this, the microcontroller can only use a clock frequency of 24 MHz when the USB module is active and the controller clock source is one of the primary oscillator modes (XT, HS or EC, with or without the PLL). This restriction does not apply if the microcontroller clock source is the secondary oscillator or internal oscillator block."
What does all that mean? I'm not too sure.
According to the USB look-up table, it is possible to use a 20Mhz crystal (these are the only ones currently in stock in Brighton's Maplins) as an external clock source and still have access to USB functionality. I think that a bit (or rather quite a lot) of trial and error will be needed here....

So I've now got a chip in my programmer, ready to try out the USB code from the Oshonsoft website (which incidentally behaves peculiarly in the simulator - it keeps jumping back to the start of the code after executing the UsbStart command) but have no way of testing it without YET ANOTHER trip to Maplins for a new crystal

0 Comments

Post a Comment

whos.amung.us

Copyright © 2009 .Nerd Club All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive Supported by Blogger Templates.