Hello, I am using Mbed to develop a software for an industrial analog sampler(It has the same MCU with Nucleo H743ZI2). Everything works fine, but the environment requests the sampler to periodically sample analog signal (2kHz+). In this case, I consider using DMA, Timer, and ADC to maximize the performance. I have done the following things:
- Generate the code in CubeMX. I use ADC1 (Triggered by Timer 6 Event Update, and send the data to DMA1 Stream 7) and ADC2 (Triggered by Timer 15 Event Update, and send the data to DMA2 Stream 7)
- Compile and validate the code from CubeMX. Everything works as expected. I can see data in the buffer.
- Migrate the code to Mbed. Specifically, I did things listed as follows:
- Disable the pin function in mbed that may collide with ADC1 and ADC2
- Copy every MX_XXX_Init() functions related to ADC, DMA, and TIM to Mbed
- Copy DMA and ADC interrupt handler to Mbed (In stm32h7xx_it.c and stm32h7xx_it.h)
- Copy Msp_Init function to Mbed (In stm32h7xx_hal_msp.c)
- Do everything mentioned in this link, including peripherals, clock and IRQHandlers.
The code passed the compilation and download, but when timer was going to generate an interrupt, system halted. The serial port printed:
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x2400242C, not allowed in ISR context
Please give me some ideas on solving that, thanks!