Github example analysis of clock definitions

Status
Not open for further replies.

yefj

Advanced Member level 5
Joined
Sep 12, 2019
Messages
1,505
Helped
1
Reputation
2
Reaction score
5
Trophy points
38
Activity points
9,113
Hello, in the link bellow we have I2C example of efr32.
There are 3 components that i am having trouble to seehow they work together.
The only clock diagram i found is in page 281 of reference manual shown bellow.
i cant see where the CORE_FREQUENCY goes?
why we enable HFLE LFXO I2c gpio ?
how its all allowing the final line i2cInit.freq = I2C_FREQ_FAST_MAX

I cant see the big picture behind it.
I'll be glad to have some intuition i could use to understand this mechanism.
Thanks.


1.
#define CORE_FREQUENCY 14000000

2.
// Enabling clock to the I2C, GPIO, LE
CMU_ClockEnable(cmuClock_I2C0, true);
CMU_ClockEnable(cmuClock_GPIO, true);
CMU_ClockEnable(cmuClock_HFLE, true);

// Starting LFXO and waiting until it is stable
CMU_OscillatorEnable(cmuOsc_LFXO, true, true);
3.
i2cInit.freq = I2C_FREQ_FAST_MAX




 

I got to some insights with this github example code.

The LFXO is selected to be HFCLK which goes to I2C and GPIO peripherals.

The big problem is How they choose the variable CORE_FREQUENCY is the frequesncy of LFXO?

Another question is regarding this line i2cInit.freq = I2C_FREQ_FAST_MAX As you said we take a clock and prescale it over and over till it flows as water threw I2C peripheral.How can we demand certain number from I2C ? if we choose a different external clock after prescaling we will get different clock in I2C

Thanks.

https://github.com/SiliconLabs/peripheral_examples/blob/master/series1/i2c/i2c/src/main_efr.c
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…