nucleo-l432kc, nucleo-l031k6, nucleo-f722ze seemingly lack the ability to change I2C frequency
For both of these boards there are consts for TWI_FREQ, however the I2CConfig type has no Frequency field and thus it is not apparent how to configure bus speed for I2C.
https://tinygo.org/docs/reference/microcontrollers/machine/nucleo-l432kc/ https://tinygo.org/docs/reference/microcontrollers/machine/nucleo-l031k6/ https://tinygo.org/docs/reference/microcontrollers/machine/nucleo-f722ze
Thank you for your consideration of this fix/enhancement.
@kenbell I was looking at this briefly, and saw that we are using some constant values based on clock speed generated by STM32CubeMX. We could keep doing this as an interim solution if we can also generate those 4 values for the typical standard and fast mode speeds for each of the boards this is currently being used for.
I was looking at STM32CubeMX but it was not immediately obvious how to regenerate those values. Could you show me how you did that and/or help out to generate values for the various getFreqRange() functions?
@deadprogram you first have to set the peripheral clock to the correct MHz in the 'Clock Configuration' tab. For L432, it's this (80MHz on PCLK1):
Resolve the clock configuration.
Then enable I2C1 peripheral, you'll now see in gray the magic value in the 'timing' setting (0x10909CEC in this case for 100kHz standard mode):
Thanks @kenbell that is exactly what I was looking for. PR coming later.
Merged into dev, tagged to close on next release. Thanks @rayozzie for report and to @kenbell for helping me out.
This was released with v0.32.0 so now closing. Thank you everyone!