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

  • Hi Ravi, Pavan,

    Thank you for the reply.
    Let me check on this and I will get back to you.

    Kind Regards,
    OV_Renesas

  • Hi,

    Waiting for your inputs.

    Thanks, in advance.

    Pavan s k

  • Hi Pavan, Ravi,

    Apologies for the delay.
    I was not able to build the project you have shared.
    I tried on SDK v6.0.18, v6.0.16, v6.0.14 and I always get this error:

    Also I am not able to find the i2c_slave_receive_transmit function anywhere inside the project you have shared. 
    Have you made any modifications inside the i2c.c/h files? 
    Can you share more infromation regarding your project idea?
    You have a central device, that is constantly reading data from a I2C sensor? Have you implemented any interrupt for this? 
    Could you please probe a logic analyzer on the Pins you have configured for I2C communication so we can see exactly what is happening?
    Also, from my understanding this I2C implementation was working on each own, but when merged with the central project leads on this NMI handler. Please correct me if I am mistaken.
    I can also see from your project that you have enabled Extended Sleep mode. Are you handling the sleep mode when you are trying to read the sensor data via I2C?

    Kind Regards,
    OV_Renesas

  • Hi sir,

    Thanks for your information.

    Please find the attached link for SDK where we have configured i2c slave in the below path.

    link - https://smetgroup-my.sharepoint.com/:f:/g/personal/ravi_mysmindia_com/EnL-STLNG6xDnEOkpM1W4TsB-P6_FNOFHbO9zb8-UVh-pQ?e=A53RWT

    File path - DA145xx_SDK\6.0.16.1144\projects\target_apps\peripheral_examples\i2c\i2c_eeprom

    Kind helps us to merge i2c slave(from the attached link above) with the central code. it's bit urgent for us.  

    Thanks for your support in advance. 

  • Hi Ravi,

    Thank you for the reply.
    I was able to build your project. 
    You have modified the sdk folders. 
    We highly recommend to NOT modify the SDK_folders unless it is necessary.
    You have heavily modified the main function inside the arch_main.c file.
    The SDK is supported as it is.
    You should not have added the i2c_slave_receive_transmit function there.By doing that you are messing with the scheduler. 
    You should start and call the I2C initialization and transmit/receive functions inside the user folders. 
    The i2c_slave_receive_transmit function you have added in the arch_main.c file should be moved on the user folders as well.
    Could you also kindly share a high-level overview of the project steps? I can see you have the default_app_on_init callback function enabled, so when do you want to start to get sensor reading via I2C?
    How often are you going to get measurements? Do you want to implement any sleep-mode into your project? 

    Kind Regards,
    OV_Renesas

  • Hi,

    Since were not much aware of the SDK modifications. We did above configurations. Below are our requirements,

    1) We want to implement hibernation sleep mode in central profile with I2C_slave integrated.

    2) Sensor will wake up the DA14531 withy GPIO interrupt at every 1 minute, then DA14531 will wake up reads the sensor data and send it to the peripheral and goes to hibernation mode again, same procedure will repeat every time.

    3) please help to add my I2C_slave code as per your method into the Central profile with low power modes.

    link - https://smetgroup-my.sharepoint.com/:f:/g/personal/ravi_mysmindia_com/EnL-STLNG6xDnEOkpM1W4TsB-P6_FNOFHbO9zb8-UVh-pQ?e=A53RWT

    File path - DA145xx_SDK\6.0.16.1144\projects\target_apps\peripheral_examples\i2c\i2c_eeprom

    Thanks, in advance.

    Ravi

Reply Children