EC21-E (QuecOpen version) change I2C frequency

Hello everybody,

I need to change the I2C frequency to a lower value respect standard 400KHz.
I need to use 10KHz (or 20KHz).
I tried to modify
mdm9607.dtsi file in
ql-ol-kernel/arch/arm/boot/dts/qcom
folder

I edit line
qcom,clk-freq-out = <10000>;

then I recompile the SDK via command

make clean
make

but once I download the new firmware it is not working. Function
Ql_I2C_Init

returns -1.

How can I modifiy the I2C frequency?

Thanks in advance for assistance.

Edit:
I tried to use 100.000KHz (respect standard 400KHz) and it works.

How can I lower the frequency of the I2C clock below 100KHz?

Thanks

Hi davdav.I probably understand your problem. But I don’t quite understand your statement. I2C protocol stipulates 100kbps, 400kbps and 3.4mbps. If it is a hardware I2C protocol, the rate can only be one of the three rates. Among them, the high rate depends on whether the module’s datasheet supports it.

Hello @Ryan_yang-Q,

Thanks for reply.

I2C is an asyncronous protocol and it can work at lower frequency.
In my case I have an external MCU which works as I2C slave device. I need lower frequency becasue I want MCU (STM8L151G2 device) to consume very few current and I need to lower its clock.

Is there any way to reduce the I2C clock frequency less than 100KHz?

Thanks

Dear davdav,
I’m very sorry to reply to you now. I checked the datasheet of stm8l151g2, as shown in the following figure: I2C protocol supports 100kHz in standard mode and 400kHz in high-speed mode. Lower clock frequencies are not supported temporarily. I guess the low clock frequency may not meet the transmission rate required by the I2C protocol. I hope my answer can explain your question. Best wishes to you.

Hello @Ryan_yang-Q,

Datasheet says “Standard mode UP TO 100KHz” which means that in standard mode you can use a lower frequency. In fact, STM8L151G2 device can work with lower frequency (I tested by itself). For example reference manual of STM8L family (RM0031) at table 91 (page 518/597) shows how to setup registers in order to get lower frequency than 100KHz (for example 50KHz, 30KHz, 20KHz).

Thus, I’m looking a way to reduce I2C frequency of EC21-E (QuecOpen version).

Thanks