Bus fault in i2c and peripheral UART sample code

*** Booting My Application v2.7.0-1d3efa8051ba ***
*** Using nRF Connect SDK v2.8.0-a2386bfc8401 ***
*** Using Zephyr OS v3.7.99-0bc3393fb112 ***
Smart clock application Init
I2C bus i2c@40003000 is  ready!
Sensor Mode is 1 
In Bsec_Iface_Init 
bme68x_interface_init 

 2 initialising i2c bus
I2c  device ready!
In bme68x_init 
In bme68x_soft_reset 
[00:00:00.039,459] <err> os: ***** BUS FAULT *****
[00:00:00.045,288] <err> os:   Precise data bus error
[00:00:00.051,391] <err> os:   BFAR Address: 0x1929920
[00:00:00.057,647] <err> os: r0/a1:  0x000000e0  r1/a2:  0x200083a5  r2/a3:  0x00000001
[00:00:00.066,925] <err> os: r3/a4:  0x200083e7 r12/ip:  0x200083b9 r14/lr:  0x000356b7
[00:00:00.076,202] <err> os:  xpsr:  0x81000000
[00:00:00.081,817] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x0001b6f7  s[ 2]:  0x200083cc  s[ 3]:  0x00000000
[00:00:00.092,987] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x0003fa54  s[ 6]: 

Hi team,

I am using ncsv2.8.0, on our custom designed nrf52832 board.

Here I am trying to integrate i2c driver code for bme688 along with bsec library in  peripheral_uart sample code.

I am able to compile but when I am trying to run the code, I am getting the above error.

Kindly let me know what went wrong with my code and configuratiion.

Thanks,

Mushtakh

Parents
  • Hello,

    Sorry for the late reply.

    First, there are a lot (!) of compiler errors in your application. You should fix those. most of them are unused parameters and functions, which are ok, but you have a lot of undeclared functions that are being used. 

    I also struggle to understand your application flow. It seems to be your i2c write function that is not working. 

    Particularly, this happens in:

    Bsec_Iface_Init() -> bme68x_init() -> bme68x_soft_reset() -> bme68x_set_regs() -> rslt = dev->write() (bme68x_i2c_write())

    in your i2c_burst_write_dt() the first parameter should be pointing to your I2C instance from devicetree. From what I can tell, you are using "i2c_dev", coming from inft_ptr->config->i2c, but your inft_ptr is just a pointer being set to BME68X_I2C_ADDR_LOW (=0x76) in bme68x_interface_init(). This needs to point to the I2C instance from devicetree. Try this instead:

    if(i2c_burst_write_dt(&dev_i2c, reg_addr, reg_data, len)){

    in bme68x_i2c_write(). 

    I couldn't get it working, but I don't have the sensor that you have. I recommend you have a look at the DevAcademy's NCS Fundamentals course, and particularly the exercise on I2C:

    https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-6-serial-com-i2c/topic/exercise-1-6-2/

    Best regards,

    Edvin

Reply
  • Hello,

    Sorry for the late reply.

    First, there are a lot (!) of compiler errors in your application. You should fix those. most of them are unused parameters and functions, which are ok, but you have a lot of undeclared functions that are being used. 

    I also struggle to understand your application flow. It seems to be your i2c write function that is not working. 

    Particularly, this happens in:

    Bsec_Iface_Init() -> bme68x_init() -> bme68x_soft_reset() -> bme68x_set_regs() -> rslt = dev->write() (bme68x_i2c_write())

    in your i2c_burst_write_dt() the first parameter should be pointing to your I2C instance from devicetree. From what I can tell, you are using "i2c_dev", coming from inft_ptr->config->i2c, but your inft_ptr is just a pointer being set to BME68X_I2C_ADDR_LOW (=0x76) in bme68x_interface_init(). This needs to point to the I2C instance from devicetree. Try this instead:

    if(i2c_burst_write_dt(&dev_i2c, reg_addr, reg_data, len)){

    in bme68x_i2c_write(). 

    I couldn't get it working, but I don't have the sensor that you have. I recommend you have a look at the DevAcademy's NCS Fundamentals course, and particularly the exercise on I2C:

    https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-6-serial-com-i2c/topic/exercise-1-6-2/

    Best regards,

    Edvin

Children
No Data
Related