I2C maximum clock speed macro
Posted: Tue Feb 07, 2017 3:33 pm
Hi,
this is merely a feature request than an issue. I am missing a macro to determine the maximum clock speed for I2C, depending on driver or port.
For instance, in ADCv2/adc_lld.h the macro "STM32_ADCCLK_MAX" is defined and some ports override it with custom values.
There is no such thing for I2C though, and some other LLDs are missing it as well (CANv1 for instance). Even worse, in I2Cv1/i2c_lld.c, function "i2c_lld_set_clock()", the configuration is checked twice with hard-coded values that differ from each other. One is 4000000 (4MHz) and the other is 400000 (400kHz). Might be I missed something, but I guess it is a typo (which would have been prevented by a macro
).
I need such a macro for setting the I2C clock to the highest possible value, depending on the connected devices. The maximum clock speed for each device is retrieved from the drivers, but the initial value (before determining the minimum of all devices) should be set to the maximum speed the MCU can handle.
Is there chance to integrate such macros in ChibiOS, or is there a particular reason why only some LLDs feature such a macro?
Best regards,
Thomas
this is merely a feature request than an issue. I am missing a macro to determine the maximum clock speed for I2C, depending on driver or port.
For instance, in ADCv2/adc_lld.h the macro "STM32_ADCCLK_MAX" is defined and some ports override it with custom values.
There is no such thing for I2C though, and some other LLDs are missing it as well (CANv1 for instance). Even worse, in I2Cv1/i2c_lld.c, function "i2c_lld_set_clock()", the configuration is checked twice with hard-coded values that differ from each other. One is 4000000 (4MHz) and the other is 400000 (400kHz). Might be I missed something, but I guess it is a typo (which would have been prevented by a macro
I need such a macro for setting the I2C clock to the highest possible value, depending on the connected devices. The maximum clock speed for each device is retrieved from the drivers, but the initial value (before determining the minimum of all devices) should be set to the maximum speed the MCU can handle.
Is there chance to integrate such macros in ChibiOS, or is there a particular reason why only some LLDs feature such a macro?
Best regards,
Thomas