I work on a product with master I2C rx and tx, MCU is STM32F295RG.
I started with home made I2C functions for reading and writing using pattern "send something and brute force while until it's finished", but faced problems with interrupt priority (if the while loop is interrupted by other interrupts, it can loose the event).
Today I tried the CPAL. First thing, it doesn't work with DMA, it seems the stop condition isn't generated (but both register and data is sent).
Then tried with IT prog mode, and it's working ... BUT, it stills require highest priority interrupts ! I tried method 1 and method 2 (for stop condition sending) and same result, as soon as there is another interrupt with higher priority, I2C is broken.
Problem is I need to reverse the polarity of an USART RX signal, and I'm using an EXTI line to sense each input signal level change and set an output with reversed polarity (which itself is tied to USART3 RX). The USART signal is 100 000 bps, the MCU is clocked at 120MHz, and the EXTI line interrupt must be highest priority for this to work (3% of 100kpbs is 36 clock cycles at 120 MHz).
I just can't manage to get both - I2C and reversed USART - working at the same time :( need help !