# SPI: speed calculation

• posted

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

• posted

Did you look at Table 68 of the datasheet?

• posted

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

• posted

to

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

Meindert

• posted

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.

• posted

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

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.