STM32G474RET ADC DMA error after changing SCB->VTOR
I have added a bootloader to my code with 0x4000 size. I added SCB->VTOR = 0x8004000 before memory jump from bootloader to app code and I also added SCB->VTOR = 0x8004000 at the first line in the app code main.c . The memory jump works well. My freeRTOs threads, UART and USB are working. But I start having ADC DMA error.
If I remove SCB->VTOR = 0x8004000 and bootloader to run my app code by itself. The ADC DMA has no error.
Is there any instruction I need to do beside setting SCB->VTOR value to make DMA work?
Jump code in bootloader:
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x8004000;
uint8_t i;
__disable_irq();
/* Clear Interrupt Enable Register & Interrupt Pending Register */
for (i=0;i<4;i++){
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
__enable_irq();
SCB->VTOR = addr;
SysMemBootJump = (void (*)(void)) (*((uint32_t *) (addr + 4)));
__set_MSP(*(uint32_t *) addr);
SysMemBootJump();
