2017-07-26 05:38 AM
Hi ,
I'm using STM32F407 Discovery kit with CubeMX version 4.21.0 and Attolic TrueStudio as an IDE. Problem is not be able to receive UART interrupts while DMA is running. In my program I can receive ADC values and UART RX messages if I do not enabled UART interrupts. (for ex: __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE)).When I enable UART interrupts, the program is running until the UART message is received, and then the program crashes. I coulden't find the reason.
I would be grateful if you can help.
2017-07-26 07:01 AM
Hello
yelkovan.yusuf
,please share some code you did so far and show us your .ioc file from CubeMX generated project.
Furthermore, what does it mean that it crashes?
Best regards,
Tilen
2017-07-27 01:26 AM
2017-07-27 01:37 AM
Also I want to add my experience about this code. If '
__HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE);
and
__HAL_UART_ENABLE_IT(&huart2, UART_IT_TC);' codes canceled, code does not crashe when uart message sent to stm32 but code does not go into the 'HAL_UART_RxCpltCallback()' function.
And crashes means that program does not go on anymore, it stops at somewhere.
2017-07-28 09:02 AM
I have added belove some information about my code and configuration.
2017-07-29 08:41 AM
I would suggest using the DMA interrupt and not the ADC interrupt to flag completion of the 3 samples.
2017-07-29 08:43 AM
>>
And crashes means that program does not go on anymore, it stops at somewhere.
Break in the debugger and understand WHERE it stopped. Perhaps an infinite loop in the Hard Fault Handler, or stuck in HAL_Delay. For the former determine what faulted, for the latter look at the interrupt preemption levels.
2017-07-31 03:25 AM
Hi Clive,
Thanks for your interest.
When I break in debugger, code usually stops in HAL_UART_IRQHanler() or in HAL DMA IRQ Handler(), not at exact position. And I think the main problem is that DMA and UART Rx interrupts have mutual influence on each other's flag configurations. So isn't it a BUG. Do not somebody have to take this issue into consideration ?
Best regards,
Yusuf
2017-10-19 07:24 PM
hi
This is the ADC sample code for stm32f103c8t6 that I made.
I attach my own code because I am not competent to advise you. ________________ Attachments : STM32ADC.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyIH&d=%2Fa%2F0X0000000b6Z%2FmrjobMMWQcEdP0hWLKDgqZbnowjfmgc9U8nnaS9xDV0&asPdf=false