Hello,
I am starting using the da14580 and I want to read a sensor using I2C and then send the data to a smartphone.
I used the peripheral example of the I2C_EEPROM with no problems to read my sensor, but then I tried to use this same functions on the BLE:APP_PERIPHERAL example of the SDK and did not work. The code stops every time in the NMI_HandlerC when the I2C function was used.
What I am doing wrong?
非常感谢你much for your help!
Device:
Hi mjara,
The reason for this is that you have enabled the WDOG, and it seems that your application is stack at somepoint (probably the I2C function waiting for data from the other which probably the 580 never got). You can disable the WDOG by #undef the CFG_WDOG in the da1458x_config_basic, in order to check where exactly your program stopped. Also the fact that the sensor works in the peripherals examples doens't mean that the response that you get from the sensor is immidiate, the I2C driver will keep on polling the sensor until the sensor is ready and finally send some data at some point. To sum up if your sensor delays the response or the 580 needs to keep probing the sensor for data and doesn't update the watchdog value (which is located at the bottom of the main_func) the wdg will eventually hit and you will end up in the NMI_Handler().
Thanks MT_dialog
Hello,
Yes, that was the problem. I disabled the WDOG and I found out that the gpio configuration of the SDA and SCL pins was not included in the periph_init function, that why the program stops.
Thank you.