AnsweredAssumed Answered

i2c Slave issue on KL25Z

Question asked by Jim Raney on Feb 26, 2013
Latest reply on Mar 2, 2013 by Jim Raney

Hello,

 

I have a KL25Z that I've been learning on.  I've recently started to work on making the board an i2c slave hooked up to a raspberry pi.  The pi i2c bus operates at 3.3v and has 1.8k pullups.  In Processor Expert I added an I2C_LDD component and set the following parameters:

 

I2C Channel: I2C1

Interrupt Service: enabled

Mode Selection: SLAVE

Address Mode: 7-bit

Slave address: 9

SDA Pin: PTE0

SCL Pin: PTE1

Enabled in init code: yes

Auto initlization: no

 

I also configured the bus for 100khz (pi default) by following the directions at KL25Z and I2C: Missing Repeated Start Condition | MCU on Eclipse to avoid the pre-scaler issue.  I left all other parameters at their defaults.  After generating code I added the i2c _Init function to main() in ProcessorExpert.c, compiled and loaded the code onto the board.

 

Once loaded and hooked up to the i2c bus I ran i2cdetect on the pi and, instead of a device being listed at address 9, I see devices listed at nearly every address on the bus:

 

root@pi-1:~# i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          03 04 05 06 07 08 -- -- -- 0c 0d 0e 0f

10: 10 11 12 13 14 15 -- -- -- -- 1a -- -- -- 1e 1f

20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e --

30: 30 -- -- 33 -- 35 36 37 38 39 3a 3b 3c 3d 3e 3f

40: 40 41 42 43 44 45 46 47 48 -- -- -- -- 4d -- --

50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e --

60: -- 61 -- -- -- 65 66 67 -- 69 6a 6b 6c 6d 6e 6f

70: 70 71 -- 73 74 75 76 --

root@pi-1:~#


Different runs show different addresses used.  As a sanity check I took an arduino that I already had running i2c code on and hooked it up to the bus (after removing the KL25Z).  It showed up at the expected address and nothing else was listed on the bus.

 

I've been poring over documentation and searching through these forums but I haven't seen anything that would point me in the right direction.  Is there something I'm missing that someone can point me to?  Or is this is a bug?

Outcomes