This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

No TWI connection with s100, Dev Kit and BLE

Dear all,

I'm trying to connect the NRF51-DK (PCA10028) with a LSM330DLC accelerometer over TWI (I2C). I'm using the ble_app_uart example, included the twi_master.h file and selected the twi_master (software) in the Run-Time environment.

I call twi_master_init() in the main function. I used the i2c.c wrapper I found here on the forum and using its readI2cReg i'm trying to read a register from the LSM330DLC in order to verify the connection. However, the first twi_master_transfer function returns false, indicating that no data was transferred successfully. I get no further errors and the UART demo still works correctly while running the application.

Can someone please point me in the right direction? Without a clear error I find it very difficult to look in the right place. I added the KEIL5 folder to the post if someone wants to check out the files: ble_app_uart.zip

Parents
  • It looks like the I2C address you used is wrong. You have to shift it one bit left

    // LSM330D I2C address
    // Accelerometer = 001100xb
    #define LSM330D_A_ADDR0     0x30  // SA0=0(GND)
    #define LSM330D_A_ADDR1     0x32  // SA0=1(VDD)
    
Reply
  • It looks like the I2C address you used is wrong. You have to shift it one bit left

    // LSM330D I2C address
    // Accelerometer = 001100xb
    #define LSM330D_A_ADDR0     0x30  // SA0=0(GND)
    #define LSM330D_A_ADDR1     0x32  // SA0=1(VDD)
    
Children
No Data