3 posts / 0 new
Last post
mjara
Offline
Last seen:4 years 1 week ago
加入:2016-08-17 20:20
Problem with I2C

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:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi mjara,

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

mjara
Offline
Last seen:4 years 1 week ago
加入:2016-08-17 20:20
Hello,

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.