UART IT problem with DMA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-26 5: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-26 7: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-27 1:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-27 1: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-28 9:02 AM
I have added belove some information about my code and configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-29 8:41 AM
I would suggest using the DMA interrupt and not the ADC interrupt to flag completion of the 3 samples.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-29 8: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-31 3: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-10-19 7: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