Now i want to add a iic device(pct1336) to nrf_desktop keyboard project, how can i do it?
Now i want to add a iic device(pct1336) to nrf_desktop keyboard project, how can i do it?
Hi,
You enable the TWIMx peripheral, but remember that this is a shared peripheral on the nRF devices, as shown here in the instantiation list in the PS for nRF52833:
https://infocenter.nordicsemi.com/topic/ps_nrf52833/memory.html?cp=4_1_0_3_1_3#topic
The peripherals with the same address space are shared, meaning that you cannot enable both SPIM0 and TWIM0 simultaneously.
If you look at the CMakeLists.txt file for nrf_desktop, there's a specific setting here for the overlay:
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/dts.overlay")
set(DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/dts.overlay")
endif()
In the case that I configure for board nrf52kbd_nrf52832, it will therefore load the file ../configuration/nrf52kbd_nrf52832/dts.overlay.
Here's what it should contain if you want to enable i2c0 (change the sda-pin and scl-pin to your wanted GPIOs):
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
sda-pin = <MY_SDA_PIN>;
scl-pin = <MY_SCL_PIN>;
};
In addition, you need to add these configurations to the prj.conf. nrf_desktop has several configuration files, as described here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.2/nrf/applications/nrf_desktop/README.html#nrf-desktop-build-types
For this case, the kconfig prj files are dependent on the build configuration, as shown in the .conf files here:
You can select the build configuration as per the documentation here:
app_ZDebug.conf and app_ZRelease.conf is likely the targets you're interested in, where you can enable I2C:
CONFIG_I2C=y CONFIG_I2C_0=y
Are you planning on using the i2c driver directly, or interfacing a already present zephyr sensor driver?
Kind regards,
Håkon
Hi,
You enable the TWIMx peripheral, but remember that this is a shared peripheral on the nRF devices, as shown here in the instantiation list in the PS for nRF52833:
https://infocenter.nordicsemi.com/topic/ps_nrf52833/memory.html?cp=4_1_0_3_1_3#topic
The peripherals with the same address space are shared, meaning that you cannot enable both SPIM0 and TWIM0 simultaneously.
If you look at the CMakeLists.txt file for nrf_desktop, there's a specific setting here for the overlay:
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/dts.overlay")
set(DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/dts.overlay")
endif()
In the case that I configure for board nrf52kbd_nrf52832, it will therefore load the file ../configuration/nrf52kbd_nrf52832/dts.overlay.
Here's what it should contain if you want to enable i2c0 (change the sda-pin and scl-pin to your wanted GPIOs):
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
sda-pin = <MY_SDA_PIN>;
scl-pin = <MY_SCL_PIN>;
};
In addition, you need to add these configurations to the prj.conf. nrf_desktop has several configuration files, as described here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.2/nrf/applications/nrf_desktop/README.html#nrf-desktop-build-types
For this case, the kconfig prj files are dependent on the build configuration, as shown in the .conf files here:
You can select the build configuration as per the documentation here:
app_ZDebug.conf and app_ZRelease.conf is likely the targets you're interested in, where you can enable I2C:
CONFIG_I2C=y CONFIG_I2C_0=y
Are you planning on using the i2c driver directly, or interfacing a already present zephyr sensor driver?
Kind regards,
Håkon