Hello,
I am using the NRF54L15 DK for development. I have configured the i2c with P1.12 as SCL and P1.14 as SDA.
below is my code in .overlay file
&pinctrl {
i2c21_default: i2c21_default {
group1 {
psels = <NRF_PSEL(TWIM_SCL, 1, 12)>, <NRF_PSEL(TWIM_SDA, 1, 14)>;
};
};
i2c21_sleep: i2c21_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 12)>, <NRF_PSEL(TWIM_SCL, 1, 14)>;
low-power-enable;
};
};
};
&i2c21 {
status = "okay";
pinctrl-0 = <&i2c21_default>;
pinctrl-1 = <&i2c21_sleep>;
pinctrl-names = "default", "sleep";
mysensor: mysensor@38{
compatible = "i2c-device";
status = "okay";
reg = < 0x38 >;
};
zephyr,deferred-init;
};
Below is the code to initialize and use I2C.
#include <zephyr/drivers/i2c.h>
#include <zephyr/device.h>
#include <zephyr/sys/util.h>
#include "i2c_driver.h"
#define I2C_NODE DT_NODELABEL(mysensor)
static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C_NODE);
void init_i2c(void)
{
if (!device_is_ready(dev_i2c.bus)) {
printk("I2C bus %s is not ready!\n\r",dev_i2c.bus->name);
}
}
void i2c_data_write(uint8_t* data, uint32_t dt_len)
{
i2c_write_dt(&dev_i2c, (const uint8_t*)data, dt_len);
}
This code gets compiled successfully, for nrf54l10 but when I flash it into the nrf54l15 dk I am getting BUS error. Following is the output.
I2C bus i2c@c7000 is not ready! [00:00:00.804,707] <err> os: ***** BUS FAULT ***** [00:00:00.804,713] <err> os: Precise data bus error [00:00:00.804,717] <err> os: BFAR Address: 0x0 [00:00:00.804,731] <err> os: r0/a1: 0x00000000 r1/a2: 0x20003bb8 r2/a3: 0x00000000 [00:00:00.804,738] <err> os: r3/a4: 0x00000000 r12/ip: 0x00000000 r14/lr: 0x00032ee9 [00:00:00.804,742] <err> os: xpsr: 0x69100000 [00:00:00.804,750] <err> os: s[ 0]: 0x0003f788 s[ 1]: 0x0000000a s[ 2]: 0x00000000 s[ 3]: 0x0002dc91 [00:00:00.804,764] <err> os: s[ 4]: 0x0000000a s[ 5]: 0x0003f788 s[ 6]: 0x20008c78 s[ 7]: 0x0000000a [00:00:00.804,771] <err> os: s[ 8]: 0x20003e60 s[ 9]: 0x00032edd s[10]: 0x20003ae0 s[11]: 0x2000480c [00:00:00.804,778] <err> os: s[12]: 0xffffffff s[13]: 0x0003290d s[14]: 0x2000480c s[15]: 0x20003bb8 [00:00:00.804,783] <err> os: fpscr: 0x20004664 [00:00:00.804,787] <err> os: Faulting instruction address (r15/pc): 0x0003e3ca [00:00:00.804,806] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0 [00:00:00.804,820] <err> os: Current thread: 0x20003bb8 (unknown) [00:00:00.923,747] <err> os: Halting system
Can anyone please help me resolve this issue?
