Hello fellow Nordic users,
I'm completely new to NRF technology (started about a month ago) and I've hit a wall, though I'm not sure of its origin.
I know may be similar to these 2:
Custom board I2C, device_is_ready() failing with init_res == 5
I built and flashed an I2C sample on nrf54l15dk and device_is_ready failed with init_res == 5.
But after reading them and trying to apply their solutions to my case it seems to be something different.
Long story short, I started with the radio-test example of nRF Connect, and broke it down so that I now have a transmitter and a receiver communicating on a custom frequency.
Now that I have 2 modules successfully communicating with each other, I wanted to add an I2C thermometer to transmit real data from on to the other. So I mounted a WE WSEN-TIDS to it, with those pins:
- VDD → VDD_MOD (3.3V)
- SCL → P0.22
- SDA → P0.21
I also had to customize the Device Tree and prj.conf files, so I tried the following:
prj.conf:
CONFIG_CLOCK_CONTROL=y CONFIG_I2C=y CONFIG_I2C_SHELL=y CONFIG_SENSOR=y CONFIG_WSEN_TIDS=y
Ophelia-III.overlay:
/ { model = "we_proteus3ev_nrf52840"; compatible = "we,we-proteus3ev-nrf52840"; aliases { tids = &we_wsen_tids; }; }; &pinctrl { uart0_default: uart0_default { group1 { psels = <NRF_PSEL(UART_TX, 1, 8)>, <NRF_PSEL(UART_RTS, 0, 11)>; }; group2 { psels = <NRF_PSEL(UART_RX, 1, 9)>, <NRF_PSEL(UART_CTS, 0, 12)>; bias-pull-up; }; }; uart0_sleep: uart0_sleep { group1 { psels = <NRF_PSEL(UART_TX, 1, 8)>, <NRF_PSEL(UART_RX, 1, 9)>, <NRF_PSEL(UART_RTS, 0, 11)>, <NRF_PSEL(UART_CTS, 0, 12)>; low-power-enable; }; }; i2c0_default: i2c0_default { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 21)>, <NRF_PSEL(TWIM_SCL, 0, 22)>; }; }; i2c0_sleep: i2c0_sleep { group1 { psels = <NRF_PSEL(TWIM_SDA, 0, 21)>, <NRF_PSEL(TWIM_SCL, 0, 22)>; low-power-enable; }; }; }; &gpiote { status = "okay"; }; &uart0 { compatible = "nordic,nrf-uarte"; status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart0_default>; pinctrl-1 = <&uart0_sleep>; pinctrl-names = "default", "sleep"; }; &i2c0 { compatible = "nordic,nrf-twi"; status = "okay"; clock-frequency = <I2C_BITRATE_STANDARD>; pinctrl-0 = <&i2c0_default>; pinctrl-1 = <&i2c0_sleep>; pinctrl-names = "default", "sleep"; we_wsen_tids: wsen_tids@38 { compatible = "we,wsen-tids"; status = "okay"; reg = <0x38>; odr = <100>; }; };
I kept the UART pins 1.08 and 1.09 for easy debugging, and using them, I found that the issue was that dev->state->init_res = 5, no matter what I tried.
I'm simply initializing the device with: "const struct device *dev = DEVICE_DT_GET_ANY(we_wsen_tids);" but device_is_ready(dev) always returns false.
I suspect this could be a hardware issue (wrong pin assignments or a bad configuration), but I can’t seem to figure it out. So I’m reaching out for assistance.
I contacted Wurth Elektronik for some advices about pins, and theorically 0.21 and 0.22 can be working with I2C (no matter which is SDA or SCL).
Here's documentation about my hardware if needed: https://www.we-online.com/components/products/manual/2611149022001_Manual%20Family%20Boards_rev1.5.pdf
Thank you for any guidance you can provide!