8 years, 4 months ago.

spi.frequency for KL46Z

I write spi.frequency(1000000); in my program and compile it. but I get 2MHz SPI frequency when observed on Oscilloscope. For 500kHz , it gives 1MHz. I changed the crystal on the board, still shows the same. Is it a bug in the spi library or my processor is damaged.

1 Answer

8 years, 4 months ago.

Assume the first one. I would have guesses in such a platform it would have been caught by now, but it is extremely unlikely that your board would be damaged such that the frequency gets wrong. Do you use your own clock setup or just a normal board? If you use your own, you can for example output a Serial signal and check if that is correct, since that is 100% sure correct in frequency.