Question
TCPP03 / X-NUCLEO-DRP1M1: Thread Safety and I2C Contention in FreeRTOS
Hello, I am developing a project using the TCPP03 (X-NUCLEO-DRP1M1) and the ST USB-PD stack on an STM32G0 with FreeRTOS.
I am concerned about the thread safety of the FLGn interrupt handling. In the standard BSP examples, the EXTI interrupt calls BSP_USBPD_PWR_EventCallback().
- I2C Contention: Since BSP_USBPD_PWR_EventCallback() performs blocking I2C reads (ReadFlagRegister), what prevents the PE_Task or CAD_Task from attempting an I2C transaction at the same time?
- ISR Safety: In an RTOS environment, is it considered safe to perform blocking I2C calls inside the FLGn ISR, given the risk of HAL_BUSY or kernel priority issues?
- Best Practice: Does ST recommend a Deferred Interrupt pattern (e.g., using USBPD_DPM_CADTaskWakeUp) to move the I2C diagnostic logic out of the ISR and into a thread context?
