FRDM-K22F KSDK+PEx I2C example

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

FRDM-K22F KSDK+PEx I2C example

1,791 Views
kentlin
NXP Employee
NXP Employee

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

3 Replies

1,172 Views
stepan_c
NXP Employee
NXP Employee

Open drain pin feature is possible to set in PinSetings component(tab "Functional properties").

Best regards
Stepan

1,172 Views
dave408
Senior Contributor II

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:

pastedImage_0.png

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.

0 Kudos
Reply

1,172 Views
kentlin
NXP Employee
NXP Employee

Thanks!!

0 Kudos
Reply