Trouble Configuring I2C BUS

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

Trouble Configuring I2C BUS

Jump to solution
1,345 Views
anvaya
Contributor II

Hello everybody,

    I found something very strange in my board.I used a mcf52259 as the cpu and configued it as an i2c master,when power on, ,the SCL and SDA line were all 1 level. But after the I2C enable code excuted,the SCL and SDA line were all turned to 0. When I tried to send some data out,the the scope could catch the data and clk so I know the MCU is still running.But why the two line are low  level in the idle time?

    I have checked hardware design,there is no different with the other i2c design at all !

    Any one had met the same problem?

 

     John Hu.

Labels (1)
Tags (3)
1 Solution
1,081 Views
anvaya
Contributor II

Thanks Tom.

Finally I found the reason.I didn't initial the i2c bus.Now it works well.

John Hu.

View solution in original post

3 Replies
1,081 Views
TomE
Specialist II

Do you have pullup resistors on the bus?

Refer to the first paragraph at:

http://en.wikipedia.org/wiki/I2c#Design

Are you using I2C0 or I2C1? Which pins are you using the I2C controller on (I2C or QSPI for I2C), QSPI, UART1, UART2 or FlexBus for I2C1)?

Are you reprogramming the Port Pin Assignment Registers to a different function after a transfer, and if you're programming them back to an I/O port (fix it so you don't, or) how have you got the I/O port programmed (input/output-0/output-1)?

Have you searched this forum to see if anybody else has had a similar problem?

On the subject of the proper values for the external pullup resistors, it should take less than 5 minutes to work out a provable engineering solution, but sometimes it can take a WEEK:

https://community.freescale.com/message/328502#328502

Tom

1,082 Views
anvaya
Contributor II

Thanks Tom.

Finally I found the reason.I didn't initial the i2c bus.Now it works well.

John Hu.

1,081 Views
Monica
Senior Contributor III

Hu,

it's great you found the root problem and you were able to fix it, thanks for sharing!

Keep up with the great job.

Best,

Monica.

0 Kudos