I try to do a driver for setting the clock of the kl25 mcu.
I wrote the FBI to FEE transiction function in this way:
uint32_t fbi2fee (uint32_t fext, uint8_t dmx32, uint8_t drst_drs, uint8_t range0, uint8_t frdiv)
uint32_t fout_MCG = 0;
MCG_C2_REG(regmap) &= ~(MCG_C2_RANGE0_MASK);
MCG_C2_REG(regmap) = MCG_C2_RANGE0(range0);
I think that the problem comes from the fact that in this state transition I forgot to use a temporary variable to clear the field C2_RANGE0 , since I was using the crystal oscillator at 8MHz, and so range0 must be equal to 1 or 2 and I write 0 in C2_RANGE0 field to clear it.
From the moment of this write on the register C2 I can't connect to the MCU.
Seems that SDA work properly, but I can' t connect my PC to MCU.
Help me! How can I unlock the MCU and this situation?