I have a project that I have used stm32f746g discovery board. It receives data with fixed size from Uart sequentially and to inform application about each data receive completed, dma callback is used (HAL_UART_RxCpltCallback function). It works fine at the beginning but after several minutes of running, the dma callback stops to be called, and as a result, the specified parameter value doesn't get updated. Because the parameter is used in another thread too (actually a rtos defined timer), I believe this problem is caused by lacking of thread safety. But my problem is that mutex and semaphore don't be supported in ISRs and I need to protect my variable in dma callback which is an interrupt routine. I am using keil rtx to handle multithreading and the timer I use is osTimer that is defined in rtx. How can I handle the issue?
Uart dma receive interrupt stops receiving data after several minutes
1.3k Views Asked by masoud At
1
There are 1 best solutions below
Related Questions in MUTEX
- Why two threads accessing one resource crashes one thread?
- std::mutex::lock fails on Windows, error code 3
- Usage of C++11 std::unique_lock<std::mutex> lk(myMutex); not really clear
- How to make a robust mutex on AIx [7.1]
- pthread process shared mutex deadlock
- C/C++ arrays with threads - do I need to use mutexes or locks?
- Shared mutex in C error in Init
- Can I use WAL mode in SQLite3 if I use an additional mutex for multiple writers?
- Programmatically close Windows console application c++
- Simple thread/mutex test application is crashing
- Pi calculator with mutex Synchronization
- Android global mutex?
- Thread concurrency in linux
- C++ mutex locking error
- Acquiring Parent Mutex from Child Object
Related Questions in SEMAPHORE
- Implement wait-notify on database level to handle deadlocks
- How to synchronise two processes using a semaphore
- Synchronizing processes with semaphores and signals in C
- "S->value <= 0" signal() implementation in semaphore with no busy waiting
- Create Semaphore in PHP linux (Centos)
- How can I use semaphore to do a correct android ble communication?
- Synchronize a program with semaphores
- Named Semaphore just not working
- Semaphores and Web Sockets
- deadlock using Semaphore
- C Semaphore strange precedence behavior
- Trying to get a Boost named_semaphore to use the Windows semaphore API
- How can I control thread count when I use "Task.WhenAll"
- How can I serialize access to a directory in Linux?
- Blocked Streaming Class with Semaphore in delphi
Related Questions in UART
- Connecting a USB serial device to the Arduino directly
- STM32F4 Handling peripheral error while making a DMA Transfer (RX)
- Retrieve data from via UART
- UART RX Interrurpt fired too early
- Send data from PC to Raspberry
- Altera UART IP Core
- UART for MSP430FR5969
- Issue sending c char* over USART
- Real time data plotting using MSP430 on python
- why picocom gets irrecognizable code
- How to disable default Raspberry Pi 2 model B UART driver/module?
- Uart / GPS driver sample buffer overflow
- UWP UART send/recieve bytes incorrectly
- I got a big trouble with BeagleboneBlack Uart
- C++ unsigned char array length
Related Questions in DMA
- STM32F4 Handling peripheral error while making a DMA Transfer (RX)
- disabling CONFIG_NET_DMA
- how is DMA-capable memory defined?
- Need Help to Develop Linux PCIe Driver using DMA Concept
- STM32F4 TIM6 interruption doesn't happen while DMA working
- Linux DMA from User Space Bus Error
- What does DMA Channel virtualization mean?
- What is the use of the DMA controller in a processor?
- C++: Using dynamic memory allocation to write a function similar to the C realloc() function (i.e. change it's size)
- Is there a way to read a file into memory using DMA in Linux?
- Direct Memory Access with JTAG in Trust Zone
- FAST DMA benefit from FPGA using threads in C++
- I'm looking for sample code to service the USCI (UART) on an MSP430 via DMA not interrupts
- UART DMA for varying sized arrays
- How to benchmark PCIe and DMA?
Related Questions in STM32F7
- problem with sprint/printf with freeRTOS on stm32f7
- Flashing the Code compatibility of STM32F767Zi processor to the STM32F746Tx
- write to SDRAM in STM32f7xxx
- problems with usb virtual com port stm32f769 discovery
- WebUSB descriptor for STM32F767
- STM32F7x6 - Setting readout protection from code without power cycle
- Using structs to centralize the hardware abstraction layers make the code execution slow
- is it possible to send big array over UDP?
- MicroPython on STM32F746 controller
- I have a problem reading ADC with DMA on STM32 F767zi. When I look into the buffer, all I see are zeros, and I do not know why?
- Lwip 1.4.1 stuck on endless while loop in tcp_fasttmr
- How to write in the SDRAM - STM32
- Why is the ST-LINK connection lost when enabling the SysTick interrupt?
- STM32F767ZI External Interrupt Handling
- How to the same DMA Stream with different DMA channel on the Cortex-M7(STM32F746)?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Generally, only one thread should communicate with the ISR. If multiple threads are accessing a variable shared with an ISR, your design is wrong and needs to be fixed. In case of DMA, only one thread should access the buffer.
You'll need to protect the variables shared between that thread and the ISR - not necessarily with a mutex/semaphore but perhaps with something simpler like guaranteeing atomic access (best solution if possible), or by using the non-interrruptable abilitiy that many ISRs have. Example for simple, single-threaded MCU applications. Alternatively just temporarily disable interrupts during access, but that may not be possible, depending on real-time requirements.