Sensor integration issue

Hello ,

- We are using DA14531 for our development.

- Have interface TPMS pressure sensor with DA14531 over I2C . and we are using DA14531 as I2C slave.-

- Firstly I have interfaced sensor with only peripheral I2C code and its working fine, can able to read the data.(E:\Dialog\Multilink\SW_Examples\DA145xx_SDK\6.0.14.1114\projects\target_apps\peripheral_examples\I2C-Master-Slave\I2C_Slave)

- the I merged my I2C code with central code of software example below is the path, when i try to run its stuck at assert warning path, not able to read the data. Please suggest why code getting hang when i merge with BLE Central code.

E:\Dialog\Multilink\SW_Examples\BLE_SDK6_examples-main_c\connectivity\central

Please suggest.

Thanks in advance

Pavan S K

Parents
  • Hi Pavan,

    Thank you for posting your question online.
    Have you configured your I2C pins and initialization inside the user_periph_setup.c/h files?
    Did you just copy the files you were interested inside the central example?
    Your projects get this assert warning during initialization?

    Kind Regards,
    OV_Renesas

  • Hi,

    Yes , I have initialized in user_periph_setup.h, Yes i have merged working I2C program into the cental and yes project gets asser warning in initialization.

    Thanks in advance

    Pavan S K3276.central.zip

  • Hi,

    Waiting for your reply.

    Thanks in advance

    Pavan S K

  • Hi Pavan,

    Thank you for the reply. 
    I downloaded your project and placed it inside the SDK v6.0.14. 
    I used the python script available for the GitRepo examples in order to set the paths correctly but I am not able to compile your project. 
    I am getting errors regarding the user_periph_setup.c/h files.
    Can you explain what these variables do and from where you have used extern for them?

    extern uint8_t transmit_buffer[16];
    extern uint8_t receive_buffer[16];

    I can also see you had undefined the GPIO_reservations function by keeping undefined the DEVELOPMENT_DEBUG macro. 
    You have not initialzied your I2C pins inside the GPIO_reservations function and on the set_pad_functions as well.
    I am not sure what the write_buffer_initialization does as well.
    And instead of this:
     memset(&i2c_configuration, 0, sizeof(i2c_configuration));
        i2c_configuration.speed = I2C_SPEED_MODE;
        i2c_configuration.mode = I2C_MODE_SLAVE;
        i2c_configuration.addr_mode = I2C_ADDRESS_MODE;
        i2c_configuration.address = I2C_TARGET_ADDRESS;
        i2c_configuration.clock_cfg.fs_hcnt = I2C_FS_SCL_HCNT_REG_RESET;
        i2c_configuration.clock_cfg.fs_lcnt = I2C_FS_SCL_LCNT_REG_RESET;
        i2c_configuration.clock_cfg.ss_hcnt = I2C_SS_SCL_HCNT_REG_RESET;
        i2c_configuration.clock_cfg.ss_lcnt = I2C_SS_SCL_LCNT_REG_RESET;

    You should use this:
       // Configuration struct for I2C
        static const i2c_cfg_t i2c_cfg = {
        .clock_cfg.ss_hcnt = I2C_SS_SCL_HCNT_REG_RESET,
        .clock_cfg.ss_lcnt = I2C_SS_SCL_LCNT_REG_RESET,
        .clock_cfg.fs_hcnt = I2C_FS_SCL_HCNT_REG_RESET,
        .clock_cfg.fs_lcnt = I2C_FS_SCL_LCNT_REG_RESET,
        .restart_en = I2C_RESTART_ENABLE,
        .speed = I2C_SPEED_MODE,
        .mode = I2C_MODE_SLAVE,
        .addr_mode = I2C_ADDRESS_MODE,
        .address = I2C_TARGET_ADDRESS,
        .tx_fifo_level = 1,
        .rx_fifo_level = 1,
        };

    And place it inside your periph_init function before the GPIO_set_pad_latch_en function.

    Kind Regards,
    OV_Renesas

  • Hi sir,

    Thanks for your input. we have done the suggested change. Now we are not getting ASSERT_WARNING. But in I2C function have one counter(variable) which need to be incremented but it is not happening.  

    MCU is not coming out from highlighted while loop. As a result MCU is going to nmi_handlerc as shown below.

    please find the attached code link below.

    https://smetgroup-my.sharepoint.com/:u:/g/personal/ravi_mysmindia_com/ESI5TrQuaIlDn04IcpBgIrYBlw49gqEs1mk9uVKdVtmkRw?e=PyV9Gs 

    Please suggest the required changes. 

    Thanks in Advance

    Ravi Kumar Anand.

  • Hi ,

    Sunny has  updated the issue behalf of me please suggest.

    Thanks in advance

    Pavan S K

Reply Children