cancel
Showing results for 
Search instead for 
Did you mean: 

configure LSE for RTC on a STM32F4DISCOVERY board.

stm32f4
Associate II
Posted on January 01, 2015 at 09:39

Hello, hapy 2015 to all.

I try to use an external LSE for RTC a STM32F4DISCOVERY .

I follow indication of clive1 on this post:

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32Discovery%2fUsing%20LSE%20for%20RTC%20on%20a%20STM32F4DISCOVERY%20board&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EA...

Component i used are:

http://it.farnell.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=15001&langId=-4&urlRequestType=Base&partNumber=2101354&storeId=10165

http://it.farnell.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=15001&langId=-4&urlRequestType=Base&partNumber=2332630&storeId=10165

Problem is that the RTC_Config function  is nont able to get the LSE ready and don't  retriev correct flag SET.

/* Wait till LSE is ready */

        while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) {}

I checked connection and they sems ok.

Anyone have suggestion to sort out ? what can i do?

Regards,

Carmelo

4 REPLIES 4
raptorhal2
Lead
Posted on January 01, 2015 at 15:04

Just to check - did you remove the two solder bridges ?

Cheers, Hal

Posted on January 01, 2015 at 18:09

Anyone have suggestion to sort out ? what can i do?

I guess you've got to identify what you've done wrong and fix that? Start with the circuitry and the components. Make sure you've made ALL the required changes, that the parts are correctly orientated, and of the correct values. Look at the software, I can't see anything you're doing.

/* Enable the PWR clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
/* Allow access to RTC */
PWR_BackupAccessCmd(ENABLE);
/* Enable the LSE OSC */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);

Look at the signal with a scope. First see if you can observe anything directly. Second observe indirectly by outputting the LSE signal out via MCO (PA8) pin and measuring that. These are the one's ST uses on the DISCO boards (when populated), along with 6.8pF capacitors.

http://www.mouser.com/ProductDetail/Epson-Timing/MC-306-327680K-E3ROHS/?qs=CU9taR8hkvbntLhqKVy/5g%3D%3D

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stm32f4
Associate II
Posted on January 01, 2015 at 20:36

Hello.

Yes i removed the soldier sb15,sb16.

This is my code:

    if (1){//(RTC_ReadBackupRegister(RTC_BKP_DR0) != 0xA5A5) {

        /* Enable the PWR clock */

        RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

        /* Allow access to RTC */

        PWR_BackupAccessCmd(ENABLE);

#if defined (RTC_CLOCK_SOURCE_LSE)

        /* Enable the Low Speed External (LSE) clock */

        RCC_LSEConfig(RCC_LSE_ON);

        /* Wait till LSE is ready */

        while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) {}

        /* Select the RTC Clock Source */

        RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);

        /* ck_spre(1Hz) = RTCCLK(LSE) / (uwAsynchPrediv + 1) * (uwSynchPrediv + 1) */

        uwSynchPrediv = 0xFF;

        uwAsynchPrediv = 0x7F;

#elif defined (RTC_CLOCK_SOURCE_LSI)

Thanks clive1.

I'll do extended analisys.

Posted on January 05, 2015 at 11:27

Try to start the LSE by manually manipulating/reading back register bits in the debugger.

JW