RTC Crashing Baite Mini?

Post here first, or if you can't find a relevant section!
Post Reply
Nutsy
Posts: 224
Joined: Sun Jul 24, 2016 4:26 pm

RTC Crashing Baite Mini?

Post by Nutsy » Sat May 06, 2017 2:07 pm

Well ive had a go adding the internal RTC to my project. And Sadly the include on its own wont crash the MCU but creating the RTC object seems to stop the MCU from starting properly.

Any ideas on what to look out for that could be causing the problem?

ag123
Posts: 624
Joined: Thu Jul 21, 2016 4:24 pm

Re: RTC Crashing Baite Mini?

Post by ag123 » Sat May 06, 2017 4:20 pm

i think the (Baite) maple mini doesn't have a 32768 crystal for LSE (low speed external clock/crystal)
if that's the case u'd likely need to initialise the RTC object using LSI (low speed internal clock)

Code: Select all

RTClock rt (RTCSEL_LSI); // initialise
http://www.stm32duino.com/viewtopic.php?f=3&t=2040
http://www.stm32duino.com/viewtopic.php?f=14&t=671
^^^ of course plugging a cheap crystal at 2 pins (PC14 OSC32_IN/ PC15 OSC32_OUT) is more fun & it may come with its own gotchas :D
as for tuning an rtc crystal, u'd need pairs of 10-15 pf capacitors, my guess is that's roughly the amount of capacitance if you touch the crystal pins with your fingers, but the 'real' answers are in that link :lol:

User avatar
ahull
Posts: 1509
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: RTC Crashing Baite Mini?

Post by ahull » Sat May 06, 2017 11:53 pm

Nutsy wrote:Well ive had a go adding the internal RTC to my project. And Sadly the include on its own wont crash the MCU but creating the RTC object seems to stop the MCU from starting properly.

Any ideas on what to look out for that could be causing the problem?
Yes. The most likely causes. The crystal isn't oscillating (90% probability). The V-Bat voltage is too low (9% probability). Pixies, gremlins, orcs or a hardware fault (1% probability).

The most likely cause of the crystal not oscillating would be the load capacitors, either not fitted or not a suitable value to match your crystal (90%), Crystal is faulty (9.9999%) ... some other problem (0.0001%)
- Andy Hull -

ag123
Posts: 624
Joined: Thu Jul 21, 2016 4:24 pm

Re: RTC Crashing Baite Mini?

Post by ag123 » Sun May 07, 2017 6:13 am

the fun part is st specifically discourages the use of 12.5pf lousy watch crystals, 1 is encouraged to use more 'legendary' 6pf crystals instead (the hi tech 'tuning fork' variety) :lol:
http://www.st.com/content/ccc/resource/ ... 164185.pdf

Code: Select all

Note: 1“External clock” figure:
To avoid exceeding the maximum value of CL1 and CL2 (15 pF) it is strongly recommended
to use a resonator with a load capacitance CL ≤ 7 pF. Never use a resonator with a load
capacitance of 12.5 pF
alternatively another way is to simply use that 8 Mhz crystal, after all it is just sitting there :D

Code: Select all

RTClock rt (RTCSEL_HSE); // initialise

Nutsy
Posts: 224
Joined: Sun Jul 24, 2016 4:26 pm

Re: RTC Crashing Baite Mini?

Post by Nutsy » Tue May 09, 2017 1:19 pm

Well......

i was using RTClock rt (RTCSEL_HSE); to load the RTC...

However No i dont have any power coming in on the AV+ or VCC, but ive been using the VIN pin to power from... This then uses the internal 3v reg on the biate... So I assumed the RTC got its power off this when powered... (I get that the RTC would loose power if power is dropped unles I put a button on what? VCC or AV+?

So you say it has an internal 8 Mhz? You mean the one that runs the main MCU? Does that get power off the button cell too?

ag123
Posts: 624
Joined: Thu Jul 21, 2016 4:24 pm

Re: RTC Crashing Baite Mini?

Post by ag123 » Tue May 09, 2017 4:27 pm

if you connect a usb cable or put 5v at VIN on the baite mini, based on the maple mini schematic
https://github.com/leaflabs/maplemini/b ... lemini.pdf
that would feed the LDO, the LDO in turn feed 3.3v to stm32

yup 8mhz is the mcu's crystal, hence if the mcu is running, it is less likely that that 8mhz crystal is not oscillating :D
the button cell is intended for VBAT pin, it is optional if you do not need to keep the RTC running if you power off the board / stm32

it may be necessary to trace exactly where it stops, and figure out the cause. My usual bag of tricks is to blink the led when it hit particular statements. and/or if possible use Serial.println("running this statement"); to trace the execution

of course if you have got a st-linkv2 / jtag / swd dongle and can do a debug it'd be more precise, but without that blinking the led doing Serial.println etc could help to trace what's happening
a usual trick i tend to do is to copy the 'library' e.g. RTC.c and RTC.h and put in the the same folder as the sketch, then i add a #include "RTC.h" to use my own copy of the library. in that way, you could put print statements in the RTC.c codes as well to identify where it stopped.

oh btw remember to try the internal RC oscaillator though, this doesn't need any crystal or any hardware, it is all built-in

Code: Select all

RTClock rt (RTCSEL_LSI); // initialise

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests