SPI clock in Arduino DUE

Hello all,

I would like to know about the SPI clock frequency in DUE. I have read this :

Arduino Due
On the Due, the system clock can be divided by values from 1 to 255. The default value is 21, which sets the clock to 4 MHz like other Arduino boards.

SO, my sensor works with 20mhz. My SPI master is DUE which runs at 84mhz by default. If I change
SPI.setClockDivider(4.2); will this yield 20mhz or it takes 4 Mhz and yields 21mhz ? I typed in my code SPI.setClockDivider(4.2); but the sketch was compiled . Can someone tell me the result or any method to find out.

thanks !

The divider is an integer. Final frequency is Mck / Divider

ok ,thanks for the quick reply.The number considered is 4. If I use 5, it is 16.8 mhz. So it will run at 16.8mhz, I guess.

1 Like