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.
已解决! 转到解答。
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