[riot-notifications] [RIOT-OS/RIOT] periph/spi: add support for printing and testing SPI clock rate (#16727)
notifications at github.com
Wed Sep 22 15:14:12 CEST 2021
> I am wondering if a min/max would be better than the assert, especially since there are no default speeds per board?
The API guarantees you that the picked clock will not be higher than the requested to avoid driving the bus out of spec. This is based on the observation that datasheets usually contain an upper bound for the SPI clock, but either no lower bound or a lower bound as low as 100 kHz or so.
So: You should never experience a blown assertion for too high frequencies (the actual clock will just saturate when maxed out). But when you request e.g. 1 Hz as SPI clock, you'll get a blown assertion.
>From the user point of view this is IMO ideal and there is no need for min / max.
For testing: I would start with a reasonably high clock (e.g. 1 MHz) and increase by 50%. Only if the returned clock config differs from the last run, it makes sense to actually test. If the clock config hasn't changed for the last 12 iterations (so was increased by more than factor 129), it should be pretty safe to assume that the maximum frequency was reached.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications