Go Down

Topic: How to set SPI clock to 76.9kHz by using the UNO R3? (Read 4 times) previous topic - next topic

jenaflex

I am coding a SPI device that required 13us clock period(76923Hz) . I calculate the clock divider is 208, but 208 is not available in the "SPI.setClockDivider()" function. How can I get the clock frequency I need?

Coding Badly


Seriously?  You have a device that requires that exact timing / frequency?

Graynomad

SPI is supposed to be bit-rate independent, what device do you have that needs such a specific rate?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

jenaflex



Seriously?  You have a device that requires that exact timing / frequency?


it's a non-standard spi device(like spi, but not). I read the communication between the master device and slave device. The clock is 76.9kHz, 8 bits, idle high, rising edge sampling.

Tom Carpenter

#4
Jun 23, 2012, 11:20 pm Last Edit: Jun 23, 2012, 11:23 pm by TCWORLD Reason: 1
Have you got a link to the datasheet?

It won't be possible to be that specific with the SPI of the Arduino unless you use a different crystal frequency (and hence modified bootloader).

It may however be possible to do it using an Timer1 or Timer2 and compare/overflow interrupts. If you can post a datasheet I can give you a better example of how the timer could be used.
~Tom~

Go Up