File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
ports/atmel-samd/common-hal/busio Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,13 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
119
119
// clkrate is always 0. baud_rate is in kHz.
120
120
121
121
// Frequency must be set before the I2C device is enabled.
122
+ // The maximum frequency divisor gives a clock rate of around 48MHz/2/255
123
+ // but set_baudrate does not diagnose this problem. (This is not the
124
+ // exact cutoff, but no frequency well under 100kHz is available)
125
+ if (frequency < 95000 ) {
126
+ mp_raise_ValueError (translate ("Unsupported baudrate" ));
127
+ }
128
+
122
129
if (i2c_m_sync_set_baudrate (& self -> i2c_desc , 0 , frequency / 1000 ) != ERR_NONE ) {
123
130
reset_pin_number (sda -> number );
124
131
reset_pin_number (scl -> number );
You can’t perform that action at this time.
0 commit comments