SPI: speed calculation

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

•  Subject
• Author
• Posted on
Hello, All!

I'd like to get speed of 500 Kbit/sec by SPI communication. I don't quite
understand how can I calculate the clock frequency to adjust to this value?
Could you please explain. I'm using ATmega162.

Thank you.

With best regards, Roman Mashak.  E-mail: snipped-for-privacy@tusur.ru

Re: SPI: speed calculation

Did you look at Table 68 of the datasheet?

Re: SPI: speed calculation
Hello, Gary!
You wrote  on 18 Nov 2004 06:12:29 GMT:

??>> I'd like to get speed of 500 Kbit/sec by SPI communication. I don't
??>> quite understand how can I calculate the clock frequency to adjust to
??>> this value? Could you please explain. I'm using ATmega162.

GK> Did you look at Table 68 of the datasheet?
yes, of course but it didn't explain to me how is _speed_ calculated
according to frequency value. That's why I asked here, i understand it's a
question of math and brains :) but nevertheless....

With best regards, Roman Mashak.  E-mail: snipped-for-privacy@tusur.ru

Re: SPI: speed calculation

to

Well, ehhhr, speed in bits per second equals the frequency of SCK....

Meindert

Re: SPI: speed calculation

You're probably over-thinking this. It's pretty simple.  A bit is sent for
every clock pulse. If you want 500Kbit/sec, then you send clock pulses at the
same rate of 500K pulses/sec. You then need to find out how much you need to
divide the clock of the ATMega162 to achieve that result and set the bits
according to that table.

Re: SPI: speed calculation
However, you must remember that the major influence in 'actual' throughput
will depend on how fast your code loads the transmit buffer on each byte to
send.

PhilW

a
the
to