2017-10-02 10:32 AM
Hi all,
I'm trying to work with STM32f030 RTC internal to save UTC calendar.
I have included in my FW application the followings functions:
- MX_RTC_Init();
- Enable RTC interface in 'stm32f00x_hal_conf.c'
- Defined RTC_ASYNCH_PREDIV and RTC_SYNCH_PREDIV parameters.
- To save RTC parameter I use 'HAL_RTC_SetTime(hrtc, sTime, RTC_FORMAT_BIN)' & HAL_RTC_SetDate(hrtc, sDate, RTC_FORMAT_BIN); functions.
- My generic clocksource function is:
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInit;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
At this moment, RTC works fine (I'm monitoring with LCD display).
Then, I integrated the SPI library functions. From this moment, RTC seems frozen. Internal RTC parameters are the same all time.
Could anyone help me?
Thanks in advance.
2017-10-02 11:41 AM
>>Then, I integrated the SPI library functions. From this moment, RTC seems frozen. Internal RTC parameters are the same all time. Could anyone help me?
Guess you'd want to look at the code you added in rather that the parts that were previously working. Clocks, mode, and replicated functions with different settings.