Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 3 months ago.
I2C Problem?
Hi,
sorry poor English. I have connected the MMA8451Q in I2C to SSCI824.
Import programSSCI824_I2Ctest
SSCI824 I2C Test Don't work.
When I run the same program in the LPC1768 is no problem.
In the case of LPC1768, MMA8451 was reply to 0x1A of device ID.
However, in the case of SSCI824, MMA8451 was reply the 0x00 of device ID.
Question relating to:

1 Answer
10 years, 3 months ago.
Do you have 'Pull Up' resistors (value 4k7 - 10k) on the SDA and CLK connections of the i2c bus?
Thank You for responce. Yes, I have 'Pull Up' resistors (value 10k) on the SDA and CLK.
posted by 28 Dec 2014IMHO, 10k is too weak, specially at 400KHz and/or multiple devices hanging off the I2C bus. Try 2.2k - 3.3k range.
Also, have you double checked the pin names called out for SDA and SCL in your code? All 4 wires (SDA, SCL, VCC, GND) are wired correctly?
posted by 28 Dec 2014Thank You for responce. I checked the connection again. and, I changed the pull-up resistor to 2.2K of the SCL and SDA. However, response of ID was 0x00. Correctly is 0x1A.
This photo is the hardware environment.
Also, check with LPC11U35QSB was work correctly. What would the problem?
posted by 29 Dec 2014I found the problem.
MMA8451 is requested by reading the Repeated Start Condition. However, LPC824 is stopped.
My souce code
#define I2C_ADDRES (0x1c<<1) memset(temp, 0, sizeof(temp)); temp[0]=0x0D; // REG_WHO_AM_I if(i2c.write(I2C_ADDRES, temp, 1, true) != 0) pc.printf("I2C write error\r\n"); memset(temp, 0, sizeof(temp)); if(i2c.read(I2C_ADDRES, temp, 1, false) != 0) pc.printf("I2C read error\r\n"); pc.printf("ID is %X\r\n",(int)temp[0]); // ID is 0x1A memset(temp, 0, sizeof(temp)); temp[0]=0x2A; // REG_CTRL_REG1 temp[1]=0x19; // Data if(i2c.write(I2C_ADDRES, temp, 2, false) != 0) pc.printf("I2C write error\r\n");
I2C Bus Sequence
LPC1768 | OK | ST, 38, AK, 0D, AK, ST, 39, AK, 1A, NK, SP | ST, 38, AK, 2A, AK, 19 AK, SP |
LPC824 | NG | ST, 38, AK, 0D, AK, SP, ST, 39, NK, 00, NK, SP | ST, 38, AK, 2A, AK, 19 AK, SP |
I will take a look at the mbed-src.
posted by 29 Dec 2014