AnsweredAssumed Answered

STM32F7 Systick question

Question asked by karpavicius.linas on Jul 20, 2015
Latest reply on Jul 27, 2015 by karpavicius.linas
Hello,
Right now i am try to remake my project for STM32F7 from STM32F4. HAL is just paint to work, i was unable to figure out what i have to write to functions to make it hal compatable, so instead i have to go with basic Cortex_m7 functions.

Right now i am facing strange problem. For some reason i need to enable systic timer, and if it not enabled, i just get into hard fault handler, with no explanation

RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
 
__PWR_CLK_ENABLE();
 
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
 
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 12;
RCC_OscInitStruct.PLL.PLLN = 400;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 2;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
HAL_PWREx_ActivateOverDrive();
 
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                            |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV2;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
 
HAL_RCC_EnableCSS();
 
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

But i don't need systic timer that counts in miliseconds, and i remouved this delay funtion from hal init library, i don't want for cortex_m7 get interrupts, even then servicing this interupt takes very little time.

Now the fun part.

//SCB_EnableICache();
//SCB_EnableDCache();

If i disable I and D cache, my interrupt works with no systick functions, I have no idea why

And interrupt code looks like this:
uint32_t counter = 0;
void EXTI0_IRQHandler(void)
  if((EXTI->PR&0x0001)==0x0001)
  {
    HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_6|GPIO_PIN_7);
    counter++;
    EXTI->PR = 0x0001;
  }
}

Any one has any idea just what a hell i going on ? I am using new IAR arm version, and i done everything in my knowledge to make good configuration for clocks and so on.

Outcomes