When using KDS2.0 + KSDK1.1.0 + PEx, fond something wrong when using the fsl_i2c component. The I2C master cannot get the ACK from slave.
The PE initial code don’t set the SCL,SDA pins to become open-drain. That is why the slave cannot pull the SDA low as a ACK.
have to add followings to set SCL,SDA as open-drain.
PORT_HAL_SetOpenDrainCmd(PORTB_BASE,2u,true);
PORT_HAL_SetOpenDrainCmd(PORTB_BASE,3u,true);
Attached is an I2C example which read the “who am I register(0x0D)” of the on-board sensor FXOS8700.
Cheers
Kent
Original Attachment has been moved to: k22_i2c_test.7z.zip
FYI, from what I can tell, this doesn't work in KDS 3 / KSDK 1.2. I just ran into this exact problem, so I went to Function Properties and made the changes there:
After having PEx regenerate the code, I went to pin_init.c, and the pins were not set to Open Drain. I then pasted in Kuan's code and then my I2C device worked perfectly.
Maybe I'm doing something wrong? I just tested this in KDS 2 / KSDK 1.1, and it doesn't work there, either.