(update) searched for 15 minutes in the files but no clue why it should not work.
The only thing I would try is to add a delay(10) or so between Wire.begin() and the Wire.setClock call so all things under the hood get time to initialize.
Thank you. I have been away to Botswana for a week so was not able to try the above. Now that I did, I still cannot get it going. I am just not clever enough
Do anyone know where else I can get an answer/work around??
Using the mbed class directly the frequency() method definitely does set it correctly. Don't know why it's not working with Wire as I don't use it.
How are you checking to see if the change is/isn't taking effect?
p.s. double-check you are using the correct Wire instance, there are three of them (Wire, Wire1, Wire2)
I am using Wire (pin20 SDA, pin 21 SCL). And I am getting the correct values from Adafruit_FXOS8700 and Adafruit_FXAS21002C. The fastest I can read the values is 455 readings/second. That is the same when reading it on the ESP32 at 400000. When I change it on the ESP32 to 1000000 the readings more than double. Nothing change on the Giga R1 when changing the i2c speed. And any other value except for 100, 400 and 1000 give me the 'red blinking light'.
I am not an exceptionally proficient programmer - just just better than a newbie - can you please explain how to use the mbed class??
The mbed i2c for the STM only supports those three frequencies - as you've seen it throws an exception if anything else is specified (see line 725)
In order to use the mbed APIs directly I've written my own classes. The adafruit libs are coded to use wire so likely not a quick task to rework them. I did notice that the adafruit I2C code does its own wire.setClock(). I wonder if that's having an effect but then can't see why ESP is working.
I want to use the Giga R1 as the ESP32 do not have enough io's. Another problem I ran into is running the two cores on the Giga. The M4 core must just read the sensors into variables and the M7 core must process the data. On the ESP32 it was easy, one core read and update variables, the other core read and process the data. The sensors are read at 1000 readings/second. If the processing core access the variable while the sensor core is writing to it the data can be out 1ms at most. Which is not a problem. I cannot get this working on the Giga as M4 writes to memory but M7 reads from the memory buffer as I understand it. Another problem I must try and solve once I can get the I2C speed up to 1000000hz.
As I understand it, yes, providing it's a single operation. However, If, for example, you were incrementing a variable (i++) then that would generate a read, the addition and then a write which wouldn't be atomic. Happy to be corrected as I'm no expert.