AnsweredAssumed Answered

K82 : FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL flag

Question asked by Eugene Hiihtaja on Jun 5, 2019
Latest reply on Jun 7, 2019 by Felipe García

Hello !

 

In your latest SDK you have configuration flag what "move" peripheral clock control out of driver source code.

 

For example in case of i2C driver :

 

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) &FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
/* Enable I2C clock. */
CLOCK_EnableClock(s_i2cClocks[I2C_GetInstance(base)]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */

 

What was reason for enable this kind of configuration ?

Can frequent enable/disable if peripherals bring some synchronisation problems or problem with low power modes , LLS3 for example ?

 

How safe to enable clocks all used peripherals at main() stage and after that only use relevant driver API.

 

For example in my case I have complex routine for recover I2C master interface ( connection to some important sensor) and it include Deinit/Init API calls of I2C driver. Basically I2C clock can be disabled and enabled again several times.

 

Whole MCU can go to LLS3 power mode sometimes and it can happens when some clocks is enabled and disabled.

 

I can see I2C API can enable/disable I2C peripheral itself and it always done together with clock.

 

So is any dangerous relation between peripheral clock and actual enabling/disabling  of peripherals ?  

 

Is any other preconditions should be kept if clock control located out of driver code ? 

 

Regards !

Eugene

Outcomes