LPC1769: I2C sends wrong address

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1769: I2C sends wrong address

253件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SplasH on Fri Mar 15 07:59:57 MST 2013
Hi,

I have a problem with the lpc1769's i2c-bus. I have connected an IMU with mpu6050 and hmc5883l (FreeIMU) to my LPCXpresso board. I use the nxp driver library and my self-written library for the imu. But I have a problem with the i2c communication. It seems like the slave address sometimes isn't send correctly.

Here is my code:
    I2C_M_SETUP_Type transfer_data;
    uint8_t rx_data;
    uint8_t tx_data;

    //Registerstatus auslesen
    tx_data = HMC5883_ID_A;        //defined as 0x0A

    transfer_data.sl_addr7bit = HMC5883_ADDRESS;        //#define as 0x1E
    transfer_data.tx_data = &tx_data;
    transfer_data.tx_length = 1;
    transfer_data.rx_length = 1;
    transfer_data.rx_data = &rx_data;
    transfer_data.retransmissions_max = 3;

    uint8_t status = I2C_MasterTransferData(i2c_bus, &transfer_data, I2C_TRANSFER_POLLING);
In most cases with "retransmissions_max" set to 3 the status returned by the i2c-function is ok. But if I set it to 0 everytime it returns "ERROR".

Attached you can find two screenshots from a logic analyzer. The first screen shows the behaviour with the code above. Sometimes a start condition and the correct address is send, but no data is read. Also it's possible that a wrong address is send. You can also see the correct sequence:  Start + 1E (write), Restart + 1E (read) and the databyte 0x42.

The second screen shows some readings of the mpu6050 (address 0x69). Here you can see that there are attempts to write to an address which doesn't exist.

What could be the problem?
0 件の賞賛
返信
0 返答(返信)