teslaworksumn / HeadMaster

DMX parsing and I2C output for the master Animatronic Heads controller
MIT License
2 stars 0 forks source link

What is our FOSC and Crystal? #41

Closed CrasherCourse closed 11 years ago

CrasherCourse commented 11 years ago

A few weeks back when I was writing pragmas we discussed a little about it.

For now I'm assuming we have a FOSC of 40MHz and 10MHz crystal (4 x 10MHZ = 40MHz). This is the maximum FOSC, but we can use a slower one if desired.

I would like this to be decided so something can be written down in our code and so we can accurately determine timing like for the baud rate of the I2C output.

@aterlumen, @tylrtrmbl any thoughts?

kevana commented 11 years ago

I'd say go with the max possible, no reason to limit ourselves.

On Tue, Nov 27, 2012 at 3:34 PM, CrasherCourse notifications@github.comwrote:

A few weeks back when I was writing pragmas we discussed a little about it.

For now I'm assuming we have a FOSC of 40MHz and 10MHz crystal (4 x 10MHZ = 40MHz). This is the maximum FOSC, but we can use a slower one if desired.

I would like this to be decided so something can be written down in our code and so we can accurately determine timing like for the baud rate of the I2C output.

@aterlumen https://github.com/aterlumen, @tylrtrmblhttps://github.com/tylrtrmblany thoughts?

— Reply to this email directly or view it on GitHubhttps://github.com/teslaworksumn/HeadMaster/issues/41.

taylortrimble commented 11 years ago

I think Rachel spec'd an 8MHz crystal, but we can order a 10MHz too. Lets do a "what if" for each, and determine which crystal gives is a better tolerance for the I2C and DMX baud rate.

Yes? No?

On Nov 27, 2012, at 3:43 PM, Kevan Ahlquist notifications@github.com wrote:

I'd say go with the max possible, no reason to limit ourselves.

On Tue, Nov 27, 2012 at 3:34 PM, CrasherCourse notifications@github.comwrote:

A few weeks back when I was writing pragmas we discussed a little about it.

For now I'm assuming we have a FOSC of 40MHz and 10MHz crystal (4 x 10MHZ = 40MHz). This is the maximum FOSC, but we can use a slower one if desired.

I would like this to be decided so something can be written down in our code and so we can accurately determine timing like for the baud rate of the I2C output.

@aterlumen https://github.com/aterlumen, @tylrtrmblhttps://github.com/tylrtrmblany thoughts?

— Reply to this email directly or view it on GitHubhttps://github.com/teslaworksumn/HeadMaster/issues/41.

— Reply to this email directly or view it on GitHub.

CrasherCourse commented 11 years ago

@tylrtrmbl might as well.

taylortrimble commented 11 years ago

@CrasherCourse Do you have time for that tonight? I could get an order in for the new crystals to chase our last order if I need to.

On Nov 27, 2012, at 4:01 PM, CrasherCourse notifications@github.com wrote:

@tylrtrmbl might as well.

— Reply to this email directly or view it on GitHub.

CrasherCourse commented 11 years ago

Both a 32M and 40MHz FOSC both evenly produce a 250K Baud for EUSART based DMX. Not sure about the I2C yet.

CrasherCourse commented 11 years ago

The internal oscillator of the PWM chip is 4MHz.
I feel that a 250K Baud rate should be fine for the I2C since the slaves use the master's clock signal and it's slower than the chip's frequency by a factor of 16. I would only get the 10 MHz crystal if we needed 10MHz instruction frequency over a 8 MHz one.

Otherwise, the 8 MHz chips already ordered are fine.

taylortrimble commented 11 years ago

Actually, now that I think about it more, we should use a 40MHz clock cycle. We have to do the DMX mapping, and we are concerned about frame rate of the DMX already.

kevana commented 11 years ago

Couldn't hurt, components are cheap.

taylortrimble commented 11 years ago

@mistressoftheelectron I'm sure I could do it, but could you give us a Digi-Key part number for a 10MHz crystal we can substitute in for our current 8MHz crystal?

mplewis commented 11 years ago

I've never known crystals to be terribly difficult to work with. Here are two that should work fine, unless I'm missing something:

SMD crystal, 887-1941-1-ND

Through-hole crystal, CTX1057-ND

taylortrimble commented 11 years ago

Neat-o @mplewis! Looks good to me. Do you know if we need to track down some 20pF caps or if the 22pF ones we ordered will be fine?

mplewis commented 11 years ago

From Wikipedia:

Adding additional capacitance across a crystal will cause the parallel resonance to shift downward. This can be used to adjust the frequency at which a crystal oscillates. Crystal manufacturers normally cut and trim their crystals to have a specified resonance frequency with a known 'load' capacitance added to the crystal. For example, a crystal intended for a 6 pF load has its specified parallel resonance frequency when a 6.0 pF capacitor is placed across it. Without this capacitance, the resonance frequency is higher.

I believe we should pick up some 20 pF caps. Are you looking for surface mount or through-hole?

taylortrimble commented 11 years ago

Wow, nice work! Yes, let's pick up some 20pF. Surface mount, 0805 I believe.

taylortrimble commented 11 years ago

478-3735-1-ND Si?

mplewis commented 11 years ago

Looks good to me!

taylortrimble commented 11 years ago

Order placed! Now one more thing before we close this— every microcontroller repo needs Fosc in the README, doesn't it? We shouldn't have to go digging through the wiki to find out things like our device and instruction frequency, so I will add that to the README.

taylortrimble commented 11 years ago

I'll actually add that to #42.