Before I proceed I'd like to point out that I've been through the recommended troubleshooting guide and that I can run the same code with exactly the same I2C slave using a STM32L476RG instead with no issues at all.
Under Chibios 18.2.0, using I2C1, with no other peripherals enabled, these are the pertinent settings I have:
Code: Select all
/*
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 TRUE
#define STM32_I2C_USE_I2C3 FALSE
#define STM32_I2C_BUSY_TIMEOUT 50
#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
#define STM32_I2C_I2C1_IRQ_PRIORITY 5
#define STM32_I2C_I2C3_IRQ_PRIORITY 5
#define STM32_I2C_I2C1_DMA_PRIORITY 3
#define STM32_I2C_I2C3_DMA_PRIORITY 3
#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
I managed to take a capture with a logic analyzer, this is produced by calling i2cMasterTransmit with 1 byte tx buffer and 3 bytes for the rx.
The write and cmd byte make it through, with the expected SCL clock, but when it is time to perform the start condition belonging to the 3 byte read, SCL remains permanently low until an application reset.
Has anybody managed to run I2C transactions with a STM32L432KC?, I noticed there's support for a nucleo board based on that MCU.
Any suggestions regarding what I could do to debug this issue further will be appreciated.
I looked into i2c_lld_master_transmit_timeout and managed to trace the call down to I2Cv2/hal_i2c_lld.c:1139
Code: Select all
/* Waits for the operation completion or a timeout.*/
msg = osalThreadSuspendTimeoutS(&i2cp->thread, timeout);
What I seem to gather there is because the timeout is INFINITE, this is deliberate, and the transaction never concludes threads don't run.
Thanks in advance,
Raul