I have a custom board with K65 with a 24MHz external oscillator (16MHz in K65 schematics). Initially, the code was not even loading because of the oscillator mismatch. Then came UART baud rate issue, which was fixed by doubling the expected baud rate in twrk65f180m.h header file in bsp. Now I am trying to interface a I2C peripheral BQ25120 (PMIC) which has a default output of 1.8V. I want to increase this voltage to 3.3V for other peripherals. This is possible only by I2C communication.I implemented the interfacing in MQX as well as in bare metal. In MQX, fread returns 0 whereas in bare metal it gives 0xFF.
To see if the code actually works,setup was emulated using K65 evaluation kit and BQ25121 evaluation kit. The code works for 3.3V but not for 1.8V. While probing the SCL,SDA lines using logic analyzer no activity is there. At times, the code actually hits all the breakpoints in 1.8V mode but at times it goes to disassembly.
It would be great if someone can clarify the following doubts and guide me with the same as i am literally stuck with this problem for quite some time.
- Can't i2c module of Kinetis work at 1.8V? Is there any code change needed for Voltage change
- Initially, I thought the problem was due to clock mismatch as crystals were different. To confirm the clock values , I probed PTA6 in trace clock out select mode and flex bus clock at CLKOUT line. I got values 86MHz as MCGOUT clock even though I was expecting 180/120MHz and 43MHz as flex bus clock when I was expecting 60MHz as per MQX BSP configuration. Are these values ok ?
- The evaluation kit doesn't support debugging at 1.8V? I tried interfacing another peripheral to K65supplied with 1.8V from internal regulator, The code doesn't run, but the custom board actually runs with 1.8V, I actually tried GPIOs and that works. It seems like MCU doesn't get a stable supply of 1.8V as the power on LED D3 on eval kit flickers and comes back
- How can I get stable debugging mode using evaluation kit at 1.8V?