zephyr/drivers/i2c
Dev Joshi a9e6fa4b29 drivers: I2C_DW: Fix I2C scan example
Solves two identical issues listed below:

Issue 1: I2C scanner example for DesignWare hardware gets stuck
indefenitely resulting in system hang up.This is because DW I2C driver
does not handle 0 byte transfer correctly which is the case for I2C
scan example.

Fixed it by overwriting the msg length to 1 if it is 0 and the
buffer is not NULL.

Issue 2: Similarly, if the I2C pins are not pulled up (nothing connected
 to I2C pins), the DW hardware does not actually send the data
(assuming contention on the bus) hence not releasing the semaphore
resulting in calling thread waiting forever.

Fixed it by adding a timeout to k_sem_take call and return error if
cannot successfully acquire it.

Tested scenarios where nothing was connected on the bus and saw the
I2C scan example complete the whole scan command. Then connected
two different sensors on the I2C bus and saw both the address on the
console. Tested both the uses cases on Raspberry Pi Pico.

Fixes #70332.

Found that micropython tackles the same issue by implementing I2C scan
commands with Soft I2C because the same reason mentioned in Issue 1.

Signed-off-by: Dev Joshi <quic_devbhave@quicinc.com>
2024-07-04 08:23:43 +02:00
..
target i2c: target: eeprom_target: add addressable size assert 2024-05-30 05:31:40 -07:00
CMakeLists.txt drivers: i2c: Add MAX32690 I2C driver 2024-06-07 13:01:50 +02:00
gpio_i2c_switch.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_ambiq.c drivers: i2c: bugfix for ambiq i2c driver 2024-07-01 09:06:05 -04:00
i2c_andes_atciic100.c
i2c_andes_atciic100.h drivers: i2c: andes: Remove the inclusion of soc.h 2024-01-30 17:56:07 +01:00
i2c_b91.c
i2c_bcm_iproc.c drivers: i2c: add Broadcom iProc I2C driver 2024-05-28 09:57:40 +02:00
i2c_bitbang.c drivers: i2c: bitbang: add get_config 2024-05-28 09:56:48 +02:00
i2c_bitbang.h drivers: i2c: bitbang: add get_config 2024-05-28 09:56:48 +02:00
i2c_cc13xx_cc26xx.c
i2c_cc32xx.c
i2c_common.c
i2c_dw_registers.h
i2c_dw.c drivers: I2C_DW: Fix I2C scan example 2024-07-04 08:23:43 +02:00
i2c_dw.h drivers: i2c: i2c_dw: update DMA node access in I2C dw 2023-12-22 09:52:59 +01:00
i2c_emul.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_ene_kb1200.c drivers: i2c: initial device driver for ENE KB1200 2024-03-15 09:39:48 +00:00
i2c_esp32.c drivers: esp32: i2c: configure clock frequency 2024-05-15 09:29:31 +02:00
i2c_gd32.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_gecko.c drivers: i2c: i2c_gecko: Refactor driver to use pinctrl api 2024-04-25 18:07:48 -04:00
i2c_gpio.c drivers: i2c: gpio: add get_config 2024-05-28 09:56:48 +02:00
i2c_handlers.c build: namespace the generated headers with zephyr/ 2024-05-28 22:03:55 +02:00
i2c_ifx_cat1.c
i2c_ifx_xmc4.c drivers: i2c: correct spelling 2024-01-15 09:59:17 +01:00
i2c_imx.c
i2c_ite_enhance.c ITE: drivers/i2c: Add a property selecting to drive I2C recovery mode 2024-04-02 14:30:48 +01:00
i2c_ite_it8xxx2.c ITE: drivers/i2c: Add a property selecting to drive I2C recovery mode 2024-04-02 14:30:48 +01:00
i2c_litex.c drivers: i2c: litex: add get_config and recover_bus 2024-05-28 09:56:48 +02:00
i2c_ll_stm32_v1.c drivers: i2c: i2c_ll_stm32_v1 2024-05-03 07:53:31 -04:00
i2c_ll_stm32_v2.c drivers: i2c: stm32: remove redundant new line 2024-06-28 08:56:09 +02:00
i2c_ll_stm32.c drivers: i2c: stm32 for V2 driver get_config with timings 2024-06-12 14:35:48 +03:00
i2c_ll_stm32.h drivers: i2c: stm32 for V2 driver get_config with timings 2024-06-12 14:35:48 +03:00
i2c_lpc11u6x.c
i2c_lpc11u6x.h
i2c_max32.c drivers: i2c: Add MAX32690 I2C driver 2024-06-07 13:01:50 +02:00
i2c_mchp_mss.c drivers: i2c: mchp_mss: remove redundant include 2024-01-19 15:13:53 +00:00
i2c_mchp_xec_v2.c
i2c_mchp_xec.c drivers: i2c_mchp: Replace slave by target 2024-02-14 12:06:20 +01:00
i2c_mcux_flexcomm.c drivers: nxp: Add reset code to driver inits 2024-05-21 16:49:42 -04:00
i2c_mcux_lpi2c_rtio.c i2c: Add rtio support to mcux lpi2c driver 2024-03-05 09:43:38 -05:00
i2c_mcux_lpi2c.c drivers: i2c: Use the NXP Flexcomm driver for interrupt handling 2024-04-02 21:00:24 -04:00
i2c_mcux.c
i2c_nios2.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_npcx_controller.c driver: I2C: npcx: re-enable interrupts after bus error 2024-01-18 10:54:25 +01:00
i2c_npcx_controller.h drivers: i2c: correct spelling 2024-01-15 09:59:17 +01:00
i2c_npcx_port.c
i2c_nrfx_twi_common.c i2c: Add nRFX TWI RTIO-compatible driver 2024-05-21 16:48:00 -04:00
i2c_nrfx_twi_common.h i2c: Add nRFX TWI RTIO-compatible driver 2024-05-21 16:48:00 -04:00
i2c_nrfx_twi_rtio.c drivers: i2c: nrfx_twi_rtio: Minor indentation fixes 2024-05-24 07:46:27 -04:00
i2c_nrfx_twi.c i2c: nrfx_twi: Refactor nrfx_twi to utilize common code 2024-05-21 16:48:00 -04:00
i2c_nrfx_twim.c drivers: i2c: i2c_nrfx_twi*: don't print errors in case of transfer failure 2023-10-27 12:29:29 +02:00
i2c_numaker.c drivers: i2c: support for Nuvoton numaker series 2023-11-27 14:34:15 +00:00
i2c_rcar.c
i2c_rtio.c rtio: Remove builtin iodev mpsc queue 2024-06-12 21:12:54 -04:00
i2c_rv32m1_lpi2c.c drivers: i2c: rv32m1: Fix build error 2024-01-23 18:14:16 +00:00
i2c_sam0.c
i2c_sam4l_twim.c
i2c_sam_twi.c
i2c_sam_twihs_rtio.c i2c: Use i2c_rtio context in sam twihs driver 2024-03-05 09:43:38 -05:00
i2c_sam_twihs.c
i2c_sbcon.c drivers: i2c: i2c_sbcon: use frequency from device tree 2024-05-28 09:56:48 +02:00
i2c_sc18im704.c
i2c_sc18im704.h
i2c_sedi.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_shell.c drivers: i2c_shell: Add direct_read sub command 2024-05-08 09:29:58 -04:00
i2c_sifive.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_smartbond.c drivers/smartbond: Remove atomic flags from drivers 2024-06-21 08:45:10 -04:00
i2c_tca954x.c drivers: i2c: set 'i2c_driver_api' as 'static const' 2024-01-17 16:09:01 +00:00
i2c_test.c
i2c_xilinx_axi.c i2c: i2c_xilinx_axi: Fix for target mode interrupt handling 2024-04-29 07:11:16 +03:00
i2c_xilinx_axi.h
i2c-priv.h
Kconfig drivers: i2c: Add MAX32690 I2C driver 2024-06-07 13:01:50 +02:00
Kconfig.ambiq drivers: ambiq: Add dependencies to avoid showing to non-ambiq platforms 2024-06-27 08:59:40 -04:00
Kconfig.andes_atciic100
Kconfig.b91
Kconfig.bcm_iproc drivers: i2c: add Broadcom iProc I2C driver 2024-05-28 09:57:40 +02:00
Kconfig.cc13xx_cc26xx
Kconfig.dw drivers: I2C_DW: Fix I2C scan example 2024-07-04 08:23:43 +02:00
Kconfig.ene drivers: i2c: initial device driver for ENE KB1200 2024-03-15 09:39:48 +00:00
Kconfig.esp32
Kconfig.gd32
Kconfig.gpio
Kconfig.i2c_emul
Kconfig.ifx_cat1
Kconfig.ifx_xmc4
Kconfig.it8xxx2
Kconfig.litex
Kconfig.lpc11u6x
Kconfig.max32 drivers: i2c: Add MAX32690 I2C driver 2024-06-07 13:01:50 +02:00
Kconfig.mchp_mss
Kconfig.mcux drivers: nxp: Add reset code to driver inits 2024-05-21 16:49:42 -04:00
Kconfig.npcx
Kconfig.nrfx i2c: Add nRFX TWI RTIO-compatible driver 2024-05-21 16:48:00 -04:00
Kconfig.numaker drivers: i2c: support for Nuvoton numaker series 2023-11-27 14:34:15 +00:00
Kconfig.rcar
Kconfig.sam0
Kconfig.sam_twihs i2c: sam twihs driver supports rtio 2024-05-04 13:23:22 +03:00
Kconfig.sbcon
Kconfig.sc18im704 drivers: i2c: sc18im704: Add dependency to UART runtime config 2023-11-15 10:02:18 +01:00
Kconfig.sedi
Kconfig.sifive
Kconfig.smartbond
Kconfig.stm32 drivers: i2c: stm32 driver V2 new timing calculation 2024-06-12 14:35:48 +03:00
Kconfig.tca954x
Kconfig.test
Kconfig.xec
Kconfig.xilinx_axi