cancel
Showing results for 
Search instead for 
Did you mean: 

TIM7 is stopping after working

fab04
Senior

Hi everybody,

I'm working on a STM32F446. I'm using the UART.

I've a function with switch/cases which instead of a function number fill a buffer.

ex :

switch(function) {

case 0x00 : Txbuffer[idx_trame++] = 0x00;break;

case 0x01 : Txbuffer[idx_trame++] = 0x00;break;

case 0x02 : Txbuffer[idx_trame++] = 0x00;break;

etc...

At the end of the function, I've the follwing function : HAL_UART_Transmit_DMA(...)

In parallel, I'm using the timer7 (triggered every 1ms).

It works well.

But, yesterday, I've added some cases, and when my software run into them, I see the tim7 stops (I've put a GPIO in the interrupt and a probe on it).

So, I see that before entering in the HAL_UART_Transmit_DMA function, it works and after it stops.

When I take a look on tim7 registers, everything seems to be OK, except UIF that keeps at 1 (so the interrupt is never resetted).

tim7.png

If you have some ideas, I'll be very happy.

 

2 REPLIES 2
Bowman32
ST Employee

The issue where TIM7's UIF flag remains set and the interrupt stops firing after calling HAL_UART_Transmit_DMA can be caused by inefficient clearing of the UIF flag before enabling interrupts, or by interrupt priority/masking conflicts introduced by DMA operations. Try to use a polling mechanism to clear UIF before enabling interrupts, verify all interrupt configurations, and ensure proper ISR implementation. Also, review interrupt priorities to avoid conflicts between DMA, UART, and TIM7.

TDK
Super User

TIM7 isn't stopping, the interrupt is just not being serviced.

If UIF=1 the interrupt will be called when the CPU gets time.

If the interrupt is never called, another interrupt is being processed. Since it happens after HAL_UART_Transmit_DMA, probably due to this. Possibly a UART error is happening and isn't being cleared.

Debug the code, hit pause, see where execution is at.

If you feel a post has answered your question, please click "Accept as Solution".