Hi @yorknh ,
I'm not really clear what you have in your scope picture, but anyway:
You do this:
NVIC_SetPriority(GPIO_B_IRQN, configLIBRARY_LOWEST_INTERRUPT_PRIORITY);
NVIC_SetPriority(DMA0_IRQn, configLIBRARY_LOWEST_INTERRUPT_PRIORITY - 4);
I assume your configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY is 4 or numerically higher.
You only need to set the priority to configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY or numerically higher if you are using FreeRTOS API calls such an interrupt handler. In your case you are allowed to used FreeRTOS in GPIO_B_IRQn, but *not* in DMA0_IRQn. I assume you know about this, and this is the case, see my article series in my other reply.
Now keep in mind that this is about interrupts, not the DMA transfer itself. So depending on what you do in your DMA transfer, you need to make sure it is re-entrant.
Or in other words: the DMA (data)transfer on the bus is de-coupled from the core running the interrupts. with your above priority setting you give the DMA IRQ a priority to preempt the GPIO interrupt, as you give it a numerically lower value compared to the GPIO interrupt. But this is only for the interrupt, the DMA transfer still happens in the background.
The other thing you should know about the ARM interrupt system is the following: https://mcuoneclipse.com/2015/10/16/nvic-disabling-interrupts-on-arm-cortex-m-and-the-need-for-a-mem... , just in case you are not aware: this is an ARM Cortex-M silicon issue, and you need to have memory barriers in place as workaround.
I hope this helps,
Erich