AnsweredAssumed Answered

FlexIO Set source clock API difference

Question asked by Lucas Magasweran on Oct 11, 2018
Latest reply on Oct 12, 2018 by Hui_Ma

Setting the FlexIO source clock is required in order to support a desired SCL clock rate range (as explained in Problem with clock rate in FlexIO I2C ).

 

In the following SDK functions, do the source clock arguments refer to the same clock? If so, is there a way to go from the 2-bit "src" in CLOCK_SetFlexio0Clock defined in the MCU datasheet to Hz? Similar to using CLOCK_GetFreq(clock_name_t clockName).

Secondly, does a deinit and reinit of the FlexIO bus to change the SCL clock rate require a call both functions (e.g. when changing the source clock to achieve a frequency outside the current range)?

/*!
* @brief Set FLEXIO clock source.
*
* @param src The value to set FLEXIO clock source.
*/

static inline void CLOCK_SetFlexio0Clock(uint32_t src)
{
SIM->SOPT2 = ((SIM->SOPT2 & ~SIM_SOPT2_FLEXIOSRC_MASK) | SIM_SOPT2_FLEXIOSRC(src));
}
/*!
* @brief Ungates the FlexIO clock, resets the FlexIO module, and configures the FlexIO I2C
* hardware configuration.
*
* Example
@code
FLEXIO_I2C_Type base = {
.flexioBase = FLEXIO,
.SDAPinIndex = 0,
.SCLPinIndex = 1,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
flexio_i2c_master_config_t config = {
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 100000
};
FLEXIO_I2C_MasterInit(base, &config, srcClock_Hz);
@endcode
*
* @param base Pointer to FLEXIO_I2C_Type structure.
* @param masterConfig Pointer to flexio_i2c_master_config_t structure.
* @param srcClock_Hz FlexIO source clock in Hz.
*/

void FLEXIO_I2C_MasterInit(FLEXIO_I2C_Type *base, flexio_i2c_master_config_t *masterConfig, uint32_t srcClock_Hz);

Outcomes