Post here first, or if you can't find a relevant section!
The arduino API documents several other speeds (1Mhz, 3.4Mhz) but mentions that the user needs to check what's supported in his hardware.RogerClark wrote: ↑Sat Oct 07, 2017 9:14 pmI think we should add this feature..
Im pretty sure I looked at the Due code and it supported other speeds - though just an expanded list of speed settings.
( I presumed perhaps the SAM architecture only had a liminted number of speeds which the hardware could operate at, because the API call accepts the frequency, and the code just finds the nearest available freq that the hardware supports. Either that or someone at Arduino just decided on those arbitary steps)
From my tests with FRAM I was able to realibly get up to 1.3Mhz, and Racemaniac was able to get around the same speed before having problems.
The peripheral can work at many different speeds with the right settings, but I understand the standard i2c speeds are only a few.
So we can take both paths, set only the standard speeds with an enum (100Khz, 400Khz, 1Mhz), or just allow any speed within the range. I wrote my code in the second form since I wanted to test how fast it could go beyong 400Khz.
For reference the DUE allows any speed and just calculates the register values that match the best, but imposes to limit:
https://github.com/arduino/ArduinoCore- ... e.cpp#L140
https://github.com/arduino/ArduinoCore- ... twi.c#L114