Skip to main content
CCars
Associate
February 13, 2019
Question

Problem with STM32F407 using RTC_SmoothCalibConfig

  • February 13, 2019
  • 4 replies
  • 955 views
  • DBP bit (PWR_CR) is set to enable write access
  • RTC_WPR is written key-sequenze (by function itself) to enable write access
  • call of RTC_SmoothCalibConfig(...) does not change Register RTC->CALR
  • return of RTC_SmoothCalibConfig(...) is SUCSESS, nevetheless RTC->CALR remains always 0x0000
  • I find no Remarks in Errata sheet about this problem
This topic has been closed for replies.

4 replies

waclawek.jan
Super User
February 15, 2019

And writing to RTC->CALR?

JW

CCars
CCarsAuthor
Associate
February 18, 2019

the function from ST library should direct write to this register, but does not, although write permissions are released. The debugger is walking to the command, the parameter have valid values and the function returns SUCCESS, but the register remains 0x0000

ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod,

                 uint32_t RTC_SmoothCalibPlusPulses,

                 uint32_t RTC_SmouthCalibMinusPulsesValue)

{

...

  /* Configure the Smooth calibration settings */

  RTC->CALR = (uint32_t)((uint32_t)RTC_SmoothCalibPeriod | (uint32_t)RTC_SmoothCalibPlusPulses | (uint32_t)RTC_SmouthCalibMinusPulsesValue);

...

}

waclawek.jan
Super User
February 18, 2019

And writing to other RTC registers at that moment succeeds?

Is RTC clock running? Is PWR_CR.DBP set (check by reading back).

JW

CCars
CCarsAuthor
Associate
February 18, 2019

ok, found the problem:

PWR_BackupAccessCmd( ENABLE );       // Allow access to BKP Domain

has to be additionally set before 'RTC_SmoothCalibConfig'

... and after don't forget to reset into safe estate with

PWR_BackupAccessCmd( DISABLE );      // deny access to BKP Domain

thx for support