Dear KSDK 2.2,
I am helping a customer migrating from KsDK1.3 to KSDK2.2.
I2c issue:
To stretch the clock in i2c slave mode, the customer was able to use the following HAL function calls in KSDK1.3 to that.
· I2C_HAL_SetBaudRate(BASEADDR, CLOCK_SYS_GetBusClockFreq(), 66, NULL);· I2C_HAL_SetSlaveBaudCtrlCmd(BASEADDR, true);
1) How would you be able to stretch the clock for I2c slave mode using KSDK2.2?
RNG issue:
The interrupt or High Assurance options in the RNG driver.SDK 1.3 supported: ·
RNGA_HAL_SetIntMaskCmd(RNG_BASE_PTR, true);· RNGA_HAL_SetHighAssuranceCmd(RNG_BASE_PTR, true);
2) How would you get do similar things with KSDK2.2?
Regards,
hy
Hi Hy Mai
For RNGA issue, KSDK 2.x RNGA driver doesn't provide this interface, customer should set these bits directly by using register macros.
RNG->CR |= RNG_CR_HA_MASK | RNG_CR_INTM_MASK;
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please mark correct. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi HY:
According reference manual, Slave Baud Rate control (SBRC) is controlled by I2Cx_C2 register. If SBRC (bit 4 ) is 0 , The slave baud rate follows the master baud rate and clock stretching may occur. The default value is 0, the slave will follow master baud rate. I think for this reason, KSDK.2.2 not provide API to do that.
To do this, it is also easy, just clear the SBRC bit from I2Cx_C2. You can refer to KSDK 1.3, you can control the register directly.
/*! @brief Set the SBRC field to a new value. */
#define I2C_WR_C2_SBRC(base, value) (I2C_RMW_C2(base, I2C_C2_SBRC_MASK, I2C_C2_SBRC(value)))
#define I2C_BWR_C2_SBRC(base, value) (BITBAND_ACCESS8(&I2C_C2_REG(base), I2C_C2_SBRC_SHIFT) = (value))
Regards
Daniel
Hi Hy:
KSDK 2.x is the evolution of KSDK 1.x into a more optimized software solution. KSDK 2.x eliminates the need for a separate HAL and Peripheral Driver, replacing there two layers with a single driver for each peripheral. The single driver provides both the low-level functionality of the HAL and the non-blocking interrupt-based functionality of the Peripheral Driver.
I2C slave config , please use I2C_SlaveInit, but for i2c baud rate, it should be decided by master, it is not necessary to config baud for slave.
Ex:
I2C_SlaveInit(EXAMPLE_I2C_SLAVE_BASEADDR, &slaveConfig, I2C_SLAVE_CLK_FREQ);
For RNGA, KSDK 2.x initialized with RNGA_Init, it seems no config with HA and INITM. I will check it and get it back to you later.
Regards
Daniel