I am developing firmware for our device with your STM32F745 microcontroller. I use STM32F7 HAL.
I also use STM32CubeMX (v.4.25.0) with STM32Cube MCU Package for STM32F7 Series (v.1.11.0).
I use EWARM (v.8.22) for building and debugging.
I think that I have found problem in HAL.
I need to make duplex transition via USART, where transmitting and receiving don’t have hard synchronization.
I found that TCIE-bit of USART was always set in UART_DMATransmitCplt() but UART_EndTransmit_IT wasn’t called sometimes! If UART_EndTransmit_IT isn’t called – “huart->gState” will not be set to HAL_UART_STATE_READY. If “huart->gState” isn’t set to HAL_UART_STATE_READY – new execution of HAL_UART_Transmit_DMA() will always return HAL_BUSY. As the result – transmuting will stop forever. And I really saw it!
I started to investigate this situations and found that TCIE-bit was cleared unexpectedly before USART interrupt was generated…
The bits of USART_CR1 register are set and cleared a few times during transfer data via USART with DMA. HAL_UART_Transmit_DMA-function enables interrupt from DMA. Then this interrupt enables USART-interrupts. And after fixing this Interrupt – it clears itself.
But most of HAL functions aren’t reentrant. Many of them executes changing of peripheral register. For example, TCIE-bit of USART_CR1-register is set from UART_DMATransmitCplt() and is cleared from UART_EndTransmit_IT(). But HAL_UART_Receive_DMA-function changes USART_CR1 too.
It is possible that UART_DMATransmitCplt() or UART_EndTransmit_IT() is executing from Interrupt handler when HAL_UART_Receive_DMA is executing from background.
I can explain my problem that USART_CR1 was been changing as from some interrupt-handler, as from background-function at the same time.
Then I set the same priority for DMA and USART Interrupts and disabled all interrupts during calling HAL_UART_Transmit_DMA() and HAL_UART_Receive_DMA (I could do it with Intrinsic functions of IAR: __disable_interrupt() and __enable_interrupt()). These my actions make impossible to execute different functions which can do the changes of USART_CR1-register.
And I really stoped fixing unexpected behavior!!! But I had to use the same priority for DMA an USART interrupts, and execute start of HAL_UART_Transmit_DMA() and HAL_UART_Receive_DMA during all interrupts were disabled.
Do you know about problem which I found?
Are you think that I do something wrong?
If my assuming is right - HAL limits me in possibility of using peripherals of STM32F745. SPL was more perfect.
My best regards,