i2C operation with SDK V2.9.0

I have a production system running a modified asset_tracker_v2 sending temperature data to AWS. All is working fine with V2.5.0 on several hundred sensors. I am trying to upgrade to v2.9.0 and I ran into a problem with I2C. I have attached my prj.conf file and my overlay file. In my code I have set up I2C as shown below but it fails whether I have any references to I2C at all.. even if I make the "#if 1" be "#if 0" so that there is no reference to I2C in any way. The program crashes on boot up with the messages show below. The setup is similar to what I have in V2.5.0. Did something change with I2C? I am completely stopped  with V2.9.0 until I can get I2C to work as in V2.5.0 and talk to my temperature sensors. any idea what I am doing wrong would be greatly appreciated.

*********************************************

system crash on bootup

Attempting to boot from address 0x8200.
I: Trying to get Firmware version
I: Verifying signature against key 0.
I: Hash: 0xfc...dd
I: Firmware signature verified.
Firmware version 1
I: Setting monotonic counter (version: 1, slot: 0)
*** Booting My Application v2.1.0-dev-12e5ee106034 ***
*** Using nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 0, Swap type: none
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 1, Swap type: none
I: Bootloader chainload address offset: 0x28000
[00:00:00.254,333] <err> os: ***** BUS FAULT *****
[00:00:00.254,364] <err> os: Precise data bus error
[00:00:00.254,364] <err> os: BFAR Address: 0x0
[00:00:00.254,394] <err> os: r0/a1: 0x00063c10 r1/a2: 0x00063c18 r2/a3: 0x01980000
[00:00:00.254,394] <err> os: r3/a4: 0x40009000 r12/ip: 0x00000000 r14/lr: 0x000527af
[00:00:00.254,425] <err> os: xpsr: 0x01000200
[00:00:00.254,425] <err> os: s[ 0]: 0x00000000 s[ 1]: 0x0005d111 s[ 2]: 0x200145dc s[ 3]: 0x00000000
[00:00:00.254,455] <err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x0003d991
[00:00:00.254,486] <err> os: s[ 8]: 0x00000001 s[ 9]: 0x000558fd s[10]: 0x000558fd s[11]: 0x2001fe58
[00:00:00.254,486] <err> os: s[12]: 0x000558fd s[13]: 0x00040400 s[14]: 0x00040400 s[15]: 0x00040400
[00:00:00.254,516] <err> os: fpscr: 0x00040400
[00:00:00.254,516] <err> os: Faulting instruction address (r15/pc): 0x0005272a
[00:00:00.254,547] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:00:00.254,577] <err> os: Current thread: 0x200140c8 (unknown)
[00:00:00.362,915] <err> os: Halting system

********************************************************************************

my I2C setup

 #if 1
/* start I2C test */
 #include <zephyr/drivers/i2c.h>

// #if DT_NODE_HAS_STATUS(DT_ALIAS(i2c0), okay)
// #define I2C_DEV_NODE DT_ALIAS(i2c0)
 #if DT_NODE_HAS_STATUS(DT_ALIAS(i2c1), okay)
 #define I2C_DEV_NODE DT_ALIAS(i2c1)
// #elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c2), okay)
// #define I2C_DEV_NODE DT_ALIAS(i2c2)
 #//elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c3), okay)
// #define I2C_DEV_NODE DT_ALIAS(i2c3)
 #else
 #error "Please set the correct I2C device"
 #endif

 const struct device *const i2c_dev = DEVICE_DT_GET(I2C_DEV_NODE);           //!< pointer to I2C device
 uint32_t i2c_cfg = I2C_SPEED_SET(I2C_SPEED_STANDARD) | I2C_MODE_CONTROLLER; //!< I2C configuartion parameters
// uint32_t i2c_cfg = I2C_SPEED_SET(I2C_SPEED_FAST) | I2C_MODE_CONTROLLER;

/* end I2C test */
 #endif

6242.prj.conf

2133.nrf9160dk_nrf9160_ns.overlay

Parents
  • Hi,

     

    <err> os: r3/a4: 0x40009000

    This is the base address of TWIM1 (and UARTE1/SPI*1), and it indicates that the fault is due to a permission issue.

    Could you try to disable TFM logging to see if this is the root of the issue? TFM uses uart1 by default, which collides with your usage of i2c1.

    CONFIG_TFM_SECURE_UART=n
    CONFIG_TFM_LOG_LEVEL_SILENCE=y

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    <err> os: r3/a4: 0x40009000

    This is the base address of TWIM1 (and UARTE1/SPI*1), and it indicates that the fault is due to a permission issue.

    Could you try to disable TFM logging to see if this is the root of the issue? TFM uses uart1 by default, which collides with your usage of i2c1.

    CONFIG_TFM_SECURE_UART=n
    CONFIG_TFM_LOG_LEVEL_SILENCE=y

     

    Kind regards,

    Håkon

Children
Related