I2C module at 1.8V for kinetis

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2C module at 1.8V for kinetis

2,103 Views
annamol
Contributor IV

Hi,

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.

  1. Can't i2c module of Kinetis work at 1.8V? Is there any code change needed for Voltage change
  2. 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 ?
  3. 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
  4. How can I get stable debugging mode using evaluation kit at 1.8V?
0 Kudos
5 Replies

1,788 Views
annamol
Contributor IV

Hi,

Thanks for the document.But code warrior as well as PEx suite doesn't support k65. So I tried generating code with KDS and PE combined for K65 and changed the values in MQX bsp_cm.c file, but no visible change as of now. Maybe I am not updating at the proper location. Will try again and update you.

But one doubt, Will the clock mismatch issue be responsible for i2c line lock up and hanging? Because after sometime my code is getting stuck in I2C_wait() function in bare metal implementation.

0 Kudos

1,788 Views
cutworth
NXP Employee
NXP Employee

Hi Alex,

You may want to look at the following commuity ticket on which pull resistor value you can use when you are supposed to run at 400kbps for I2C. With 10k pullup, your cap loading on I2C bus will be very small (about 29pF). I suppose for your case, you will not be able to run at 400kbps.

https://community.nxp.com/thread/435467 

Hao

0 Kudos

1,788 Views
cutworth
NXP Employee
NXP Employee

Hi Alex,

K65 can work at 1.8V, you can find that TWR K65 board support operating it under 1.8V. For I2C operating under 1.8V, yes, it can. But I would need to have more details from you to know what is happening.

What baud rate you intend I2C operate? Or did you have a chance to measure I2C output and see its baud rate? Which specific I2C pin you used? For K65, some I2C pin are high drive, some are not. What is the I2C pull up you used and how much cap loading you expect on I2C pins? 

For the MQX BSP change, I suppose you do have some problem, for you did not have intended clock output on CLKOUT, but this will not impact I2C operation under 1.8V. Which code base you used? Classic MQX or MQX inside KSDK?

Also debugging under 1.8V is possible. What exact problem you have for debugging? 

Hao

0 Kudos

1,788 Views
annamol
Contributor IV

Hi,

Lack of a stable 1.8V from the regulator was causing my debugging to  fail in K65 evaluation kit. I removed all jumpers in J9 and gave 1.8V externally from another power supply at TP14, so the code and everything was working in evaluation Kit.

Regarding clock, what all settings needs to be changed as per external crystal of 24MHz in BSP. I played around with SIM_CLKDIV and VCO divider factors, but no change was happening in the custom board while probing at PTA6. My assumption is clock mismatch is the reason behind all problems in custom board. Please correct me if I am wrong.

I configured I2C0_F factor as 0x16 and the bare metal implementation was working fine on the custom board. The I2C0 lines PTD8 and PTD9 were used with an external pullup of 10k. I want a baud rate of 400Kbps at 60MHz bus clock. It would be great if you can help me in getting in this configuration in MQX.

0 Kudos

1,788 Views
soledad
NXP Employee
NXP Employee

Hi,

Attached to this, you will find a document that describes how to change default clock settings in Kinetis BSPs.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos