cancel
Showing results for 
Search instead for 
Did you mean: 

HAL Timer not working in Application Project

TShet.2
Associate III

Hello,

 

I am trying to build a bootloader project using STM32F030CCT6TR cortex -M0 controller.

I have copied the interrupt vector table from start of the Flash location(0x08000000) to to RAM in both Bootloader and Application Project.

I am getting the interrupts after jumping to the Application project but the HAL_Delay() function is not working.

It was working fine in Bootloader.

Does HAL_Delay Tick function has a separate isr vector routine in the flash and does it also need to be copied to the RAM to working Application Project.

 

Here is the code that I have used to copy isr vector  from flash to RAM.

In the Main file:

/* USER CODE BEGIN PD */
#define VECTOR_TABLE_SIZE (31 + 1 + 7 +9)//31 positive vectors, 0 vector, and 7 negative vectors (and extra 9 i dont know why)
#define SYSCFG_CFGR1_MEM_MODE__MAIN_FLASH 0 // x0: Main Flash memory mapped at 0x0000 0000
#define SYSCFG_CFGR1_MEM_MODE__SYSTEM_FLASH 1 // 01: System Flash memory mapped at 0x0000 0000
#define SYSCFG_CFGR1_MEM_MODE__SRAM 3 // 11: Embedded SRAM mapped at 0x0000 0000

#define ETX_APP_FLASH_ADDR 0x08008000 //Application's Flash Address
/* USER CODE END PD */

 

/* USER CODE BEGIN PV */
volatile uint32_t __attribute__((section(".ram_vector,\"aw\",%nobits @"))) ram_vector[VECTOR_TABLE_SIZE];
extern volatile uint32_t g_pfnVectors[VECTOR_TABLE_SIZE];
/* USER CODE END PV */

 

 /* USER CODE BEGIN 1 */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;  // early enable to ensure clock is up and running when it comes to usage
        for (uint32_t i = 0; i < VECTOR_TABLE_SIZE; i++) {//copy vector table
          ram_vector[i] = g_pfnVectors[i];
        }
        SYSCFG->CFGR1 = (SYSCFG->CFGR1 & ~SYSCFG_CFGR1_MEM_MODE) | (SYSCFG_CFGR1_MEM_MODE__SRAM * SYSCFG_CFGR1_MEM_MODE_0);  // remap 0x0000000 to RAM
 
  /* USER CODE END 1 */
 
In the Linker file:
 
added
/* redirected vector must go to top of the RAM */
.ram_vector :
{
*(.ram_vector)
} >RAM
 
 
1 REPLY 1
TDK
Guru

The SysTick handler needs to increment the appropriate variable in order for HAL_Delay to work. Do you call HAL_InitTick anywhere? Usually it's called in HAL_RCC_ClockConfig.

If you feel a post has answered your question, please click "Accept as Solution".