diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.cpp b/libraries/AP_HAL_ChibiOS/RCOutput.cpp index 779dd3b124..778f7e2aab 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCOutput.cpp @@ -805,7 +805,9 @@ void RCOutput::dma_allocate(Shared_DMA *ctx) for (uint8_t i = 0; i < NUM_GROUPS; i++ ) { pwm_group &group = pwm_group_list[i]; if (group.dma_handle == ctx) { + chSysLock(); dmaStreamAllocate(group.dma, 10, dma_irq_callback, &group); + chSysUnlock(); } } } @@ -818,7 +820,9 @@ void RCOutput::dma_deallocate(Shared_DMA *ctx) for (uint8_t i = 0; i < NUM_GROUPS; i++ ) { pwm_group &group = pwm_group_list[i]; if (group.dma_handle == ctx) { + chSysLock(); dmaStreamRelease(group.dma); + chSysUnlock(); } } }