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: mrv@tusur.ru
SPI: speed calculation
Started by ●November 18, 2004
Reply by ●November 18, 20042004-11-18
>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.Did you look at Table 68 of the datasheet?
Reply by ●November 18, 20042004-11-18
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: mrv@tusur.ru
Reply by ●November 18, 20042004-11-18
"Roman Mashak" <mrv@tusur.ru> wrote in message news:cnhjj9$14u7$1@mpeks.tomsk.su...> 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 adjustto> ??>> 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....Well, ehhhr, speed in bits per second equals the frequency of SCK.... Meindert
Reply by ●November 18, 20042004-11-18
> 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....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.
Reply by ●November 19, 20042004-11-19
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 "Gary Kato" <garykato@aol.com> wrote in message news:20041118034430.08355.00000847@mb-m04.aol.com...> > 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'sa> >question of math and brains :) but nevertheless.... > > 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 atthe> same rate of 500K pulses/sec. You then need to find out how much you needto> divide the clock of the ATMega162 to achieve that result and set the bits > according to that table. >