stm32/i2c: Fix I2C frequency calc so it doesn't exceed requested rate.
Prior to this commit, the actual I2C frequency can be faster than specified one and it may exceed the I2C's specification for Fast Mode. The frequency of SCL should be less than or equal to 400KHz in Fast Mode. This commit fixes this issue for F4 MCUs by rounding up the division in the frequency calculation.
This commit is contained in:
@@ -91,6 +91,10 @@ General Methods
|
||||
- *sda* is a pin object for the SDA line
|
||||
- *freq* is the SCL clock rate
|
||||
|
||||
In the case of hardware I2C the actual clock frequency may be lower than the
|
||||
requested frequency. This is dependant on the platform hardware. The actual
|
||||
rate may be determined by printing the I2C object.
|
||||
|
||||
.. method:: I2C.deinit()
|
||||
|
||||
Turn off the I2C bus.
|
||||
|
||||
@@ -96,6 +96,10 @@ Methods
|
||||
that DMA transfers have more precise timing but currently do not handle bus
|
||||
errors properly)
|
||||
|
||||
The actual clock frequency may be lower than the requested frequency.
|
||||
This is dependant on the platform hardware. The actual rate may be determined
|
||||
by printing the I2C object.
|
||||
|
||||
.. method:: I2C.is_ready(addr)
|
||||
|
||||
Check if an I2C device responds to the given address. Only valid when in controller mode.
|
||||
|
||||
Reference in New Issue
Block a user