Are the crystal load capacitors fitted?
[pokemon99 – Fri Aug 04, 2017 4:34 pm] –
Yes there is. Bottom of the board. Blue pill board
Do you have any way of measuring the load capacitors, since it is rather odd that the crystal is missing, so there is a chance that there are other issues with the board. Can you post a couple of pictures of your board, as modified with your crystal, both the front and back.
and the quartz of the motherboard has a capacity of 12pf
.. and this one -> http://www.stm32duino.com/viewtopic.php?t=594
.. one other thing to consider, these small crystals are pretty delicate easily damaged when soldering, so it may not have survived the “transplant operation”.
They are extremely cheap however, and you can easily pick up a replacement for a few cents for example -> https://www.ebay.co.uk/sch/sis.html?_nk … 2749.l2658
If you have access to an oscilloscope, you can check to see if the oscillator is oscillating, by scoping the pins of the RTC crystal.
If you don’t have an oscilloscope then you might enjoy these links.
http://www.stm32duino.com/viewtopic.php?t=107
https://github.com/pingumacpenguin/STM32-O-Scope/wiki
One other trick, try placing your finger on top of each of the load capacitors in turn and see if the oscillator starts. The small change in capacitance and a little bit of interference induced by your finger may be enough to start it.
I know on some MCU’s they are tuned to only work with a 32kHz crystal and you can’t use any other values, because the oscillator circuit inside the MCU will not run.
RTCSEL_HSE does not work, at least I did not succeed
You need to power from a battery to maintain the RTC and also put the MCU into the appropriate low power mode
The pruned power is saved but does not go, I understand that the chip does not supply power and time does not go, and the backup domain is also saved. That’s enough for me
[ahull – Sat Aug 05, 2017 7:59 am] –
If you don’t have an oscilloscope then you might enjoy these links.
http://www.stm32duino.com/viewtopic.php?t=107
https://github.com/pingumacpenguin/STM32-O-Scope/wikiOne other trick, try placing your finger on top of each of the load capacitors in turn and see if the oscillator starts. The small change in capacitance and a little bit of interference induced by your finger may be enough to start it.
i’m half way wondering if it is after all quite feasible to patch that 32khz XTAL pin into the ADC pin on the same MM/BP to troubleshoot the 32khz crystal
![]()
[ag123 – Wed Aug 09, 2017 7:16 pm] –[ahull – Sat Aug 05, 2017 7:59 am] –
If you don’t have an oscilloscope then you might enjoy these links.
http://www.stm32duino.com/viewtopic.php?t=107
https://github.com/pingumacpenguin/STM32-O-Scope/wikiOne other trick, try placing your finger on top of each of the load capacitors in turn and see if the oscillator starts. The small change in capacitance and a little bit of interference induced by your finger may be enough to start it.
i’m half way wondering if it is after all quite feasible to patch that 32khz XTAL pin into the ADC pin on the same MM/BP to troubleshoot the 32khz crystal
![]()
I think attempting that might be more trouble than it is worth, I can’t think of a simple way to test the crystal with the MM. .
Do you have a multimeter that does frequency measurement, or an oscilloscope?
You could also build a crystal tester with a couple of transistors or a 74LS04 or 74HC04 quad inverter.
Connecting the ADC to the pin will load it. And the oscillator already seems to be temperamental at the best of times
I dropped the crystal from another board and soldered it from the motherboard instead and it works. I took a working crystal and soldered to a problem board that did not help, changed the capacitors and checked the chip feet. Nothing helped. I think that the defective chip is caught.
[RogerClark – Mon Aug 07, 2017 7:35 am] –
RTC cant possibly run when power is removed.You need to power from a battery to maintain the RTC and also put the MCU into the appropriate low power mode
Any chance to get internal RTC running when backup battery is connected, but main CPu Power is off?
I am facing this problem.
Clock remembers date and time just before cpu lpost power, but clock is stopped.
It restarts ahen CPU is powered again.
Any advise?
Here is clock code:
// RTC and NVRam initialisation
#include <RTClock.h>
RTClock rt (RTCSEL_LSI); // initialise RTC
#define TZ "UTC+1"
time_t tt;
//time_t tt1;
char weekday1[][7] = {"Nie", "Pon", "Wto", "Sro", "Czw", "Pia", "Sob"}; // 0,1,2,3,4,5,6
//char weekday1[][7] = {"Niedzi", "Ponied", "Wtorek", "Sroda", "Czwart", "Piatek", "Sobota"}; // 0,1,2,3,4,5,6
#include <OLED_I2C.h>
OLED myOLED(6, 7, 8); //SDA = 6, SCL = 7, RESET = 8 Niepodłaczone
extern uint8_t SmallFont[];
//extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];
//extern uint8_t Standard5x7[];
#define LED_PIN LED_BUILTIN
// This function is called in the attachSecondsInterrpt
void blink ()
{
digitalWrite(LED_PIN,!digitalRead(LED_PIN));
}
void setup()
{
myOLED.begin();
myOLED.setFont(SmallFont);
//myOLED.setFont(Standard5x7);
pinMode(LED_PIN, OUTPUT);
rt.attachSecondsInterrupt(blink);// Call blink
}
void loop()
{
if (rt.getTime()!=tt)
{
tt = rt.getTime();
Serial.print("Time is: ");
Serial.println(tt);
serialCurrentTime();
SetTime();
oledCurrentTime();
}
}
void serialCurrentTime() {
//rtclock.breakTime(tt, mtt);
char Buf[24];
snprintf(Buf, sizeof(Buf),"%s %04d/%02d/%02d %02d:%02d:%02d",
weekday1[rt.weekday()],(rt.year()+1970),rt.month(),rt.day(),
rt.hour(),rt.minute(),rt.second());
Serial.println(Buf);
}
void SetTime() {
Serial.println("Podaj datę i czas w formacie yyyy-mm-dd hh:mm dzien(1..7)<ENTER>");
while (Serial.available() > 0) {
int Year = Serial.parseInt();
int Month = Serial.parseInt();
int Day = Serial.parseInt();
int Hour = Serial.parseInt();
int Minute = Serial.parseInt();
int Wkday = Serial.parseInt();
if (Serial.read() == '\n') {
int Sec = 0;
int Yr = Year - 1970;
tm_t mtt = { Yr, Month, Day, Wkday, 11, Hour, Minute, Sec };
tt = rt.makeTime(mtt);
rt.setTime(tt);
}
}
}
void oledCurrentTime() {
char Buf[22];
//Wyświetl datę
myOLED.clrScr();
snprintf(Buf, sizeof(Buf),"%s %04d/%02d/%02d",
weekday1[rt.weekday()],(rt.year()+1970),rt.month(),rt.day());
myOLED.setFont(SmallFont);
// myOLED.setFont(Standard5x7);
myOLED.print(Buf,CENTER,0);
//Wyświetl czas
snprintf(Buf, sizeof(Buf),"%02d-%02d-%02d",
rt.hour(),rt.minute(),rt.second());
// myOLED.print(Buf,CENTER,9);
// myOLED.setFont(MediumNumbers);
myOLED.setFont(BigNumbers);
myOLED.print(Buf,CENTER,18);
myOLED.update();
}



