This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I'm doing an application with an MSP430F5439 where I need to use the RTC as calendar mode. I have configured it like this:
RTCCTL01 |= RTCBCD + RTCHOLD + RTCMODE;
RTCYEAR = 0x2010; // Year = 0x2010
RTCMON = 0x4; // Month = 0x04 = April
RTCDAY = 0x05; // Day = 0x05 = 5th
RTCDOW = 0x01; // Day of week = 0x01 = Monday
RTCHOUR = 0x10; // Hour = 0x10
RTCMIN = 0x32; // Minute = 0x32
RTCSEC = 0x45; // Seconds = 0x45
RTCCTL01 &= ~(RTCHOLD); // Start RTC calendar mode
The clocks of the system are: MCLK = SMCLK = 16MHz and ACLK = 4MHz.
The problem is that is very fast (minutes pass like if they were seconds).
How I can solve this?
Thanks you.
That's the problem. Teh RTC has an internal 16 bit prescaler. In calendar mdoe, it acts as 15 bit prescaler, so each second counts by one for each 32768 clock ticks received. This is for using the usual (and precise) 32768Hz watch crystals. If you feed 4MHz into it instead, it will of course count (4000000/32768) times as fast. Which is a factor of 122.07.Santiago Migliorelli said:ACLK = 4MHz.
Jens-Michael Gross said:If you feed 4MHz into it instead, it will of course count (4000000/32768) times as fast. Which is a factor of 122.07.
Ok, and can I solve this in some way?
I couldn't find the MSP430F5439? is it the MSP430F5438 ?
But what I can say ..is that you did not mention having a 32768Hz Crystal, though this is the required frequency for the RTC_B module to operate...
Usually you need to add an external oscillator LFXT1 Low Frequency eXTernal 1 to have the RTC running ...
Best,
Fredoo.net said:I couldn't find the MSP430F5439? is it the MSP430F5438 ?
Yes is the MSP430F5438, sorry.
Fredoo.net said:is that you did not mention having a 32768Hz Crystal, though this is the required frequency for the RTC_B module to operate...
I have it, bus this MSP only haves RTC_A
Ok, my bad it is then the RTC_A Module,
But you need to configure the RTC Module so that the input clock source is your 32768Hz Crystal.
In the datasheet it says :
The prescale dividers, RT0PS and RT1PS, are automatically configured to provide a 1-s clock interval for
the RTC_A. RT0PS is sourced from ACLK. ACLK must be set to 32768 Hz (nominal) for proper RTC_A
calendar operation.
Therefore you need to configure your ACLK to be sourced from your LFXT 32768Hz Clock.
This is done in the UCSCTL4 register in which you choose your ACLK source.
The problem is that I need that the ACLK = 4MHz, that is because I'm asking for another option.
Well, I am unaware of any possible bypass for that matter ...
In Counter mode you can choose SMCLk or ACLK but in calendar mode there is no such option ...
The Clock is sourced from RT1PS which is sourced on ACLK,
You have to define your ACLK to that 32768 frequency and look for another source on your other modules requiring the 4MHz..
If you detail the modules you're using and the required frequency we may help you find a setting matching your requirements as a whole.
I'm very grateful for your answers, but the problem can't not be solved putting ACLK to 32786Hz, I need the ACLK, MCLK and SMCLK at the values I have them. I only want to know if there is the possibility to run correctly the RTC using ACLK to 4MHZ
Santiago Migliorelli said:I only want to know if there is the possibility to run correctly the RTC using ACLK to 4MHZ
The answer is no.
MaciejKucia said:The answer is no.
So that is a really bad notice. And the isn't an external pin or something to connect to source the RTC clock?
How about having MCLK = 16Mhz , SMCLK = 4MHz and ACLK = 32khz ?
This is the only way to achieve RTC_A Calendar mode .. otherwise change for another MSP430 with RTC_B in which you source directly your clock signal from external pin...
Yes I think that is the only solution... I will have to spend 2 days changing connections =(
I don't know your applicaiton. What do you need ACLK=4MHz for?Fredoo.net said:How about having MCLK = 16Mhz , SMCLK = 4MHz and ACLK = 32khz ?
**Attention** This is a public forum