cancel
Showing results for 
Search instead for 
Did you mean: 

How to De-init the SysTick clock?

Aatif Shaikh1
Associate III

Hello,

Currently, I'm working on a project in which the boat-loader is already present. Now, in the boat-loader, there are several things which I'm not using i.e Systick clock, DMA etc. So, I want to De-init all the unnecessary peripherals to run the CPU more efficiently. Unfortunately, I couldn't find anything related to how can I Dinit the Systick.

I'm using STM32F103CBT6 and Standard peripheral Library ( STSW-STM32054 ).

14 REPLIES 14
/*!< Uncomment the following line if you need to relocate your vector Table in Internal SRAM. */ 
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x0 
/*!< Vector Table base offset field. This value must be a multiple of 0x200. */
 
 
#ifdef VECT_TAB_SRAM
            SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; 
/* Vector Table Relocation in Internal SRAM. */ 
#else
            SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; 
/* Vector Table Relocation in Internal FLASH. */
#endif 

I've noticed, the VECT_TAB_OFFSET is same in both the code. I tried multiple combination as well i.e: modify the VECT_TAB_OFFSET by 0x200, un-commented the VECT_TAB_SRAM, but still, I'm facing the same issue.

Piranha
Chief II

I would safely toss out almost all configuration that bootloader does and start from a "clean" state.

  1. Disable interrupts on CPU.
  2. Disable SysTick and set it to default values.
  3. Enable HSI and switch system clock to it.
  4. Disable all other clocks and set RCC registers to default values.
  5. Set FLASH registers to default values.
  6. Reset all peripherals.
  7. Disable all interrupts in NVIC.
  8. Clear all pending interrupts in NVIC.
  9. Relocate VTOR.
  10. Execute DSB.
  11. Enable interrupts on CPU.

After something like this with probably some other modifications just start as normally.

> I tried multiple combination as well i.e: modify the VECT_TAB_OFFSET by 0x200, un-commented the VECT_TAB_SRAM

Why? Can you explain why did you think that any of these gets the address of the application vector table in SCB->VTOR ?

Put the address of the vector table of your application in SCB->VTOR. Verify that it never gets overwritten by some dumb HAL code.

Aatif Shaikh1
Associate III

thanks Everyone, with all your help, I've successfully solved the issue.

  1. VECT_TAB_OFFSET set to the ( base address of main code - 0x8000000 ).
  2. disable and De-init all the peripherals (SysTick->CTRL = 0; really does work for disabling the SysTick).
  3. Clear the pending interrupt request.
  4. Re-Init all the peripherals.

I've read the instruction wrongly, Now, I realize I've to give the ( base address - 0x8000000 ) as an offset.