hey man this is sudhagar i have configured alarm a for every 1 second using internal rtc in stm32 with 32.768 lse crystal.i am receiving some gos string in 0 th second in a minute and im writing it on rtc data register the alarm interruptis not generated for 0 th second why?
Hi Matej. How can we pause and reset the running RTC? I want to implement something like a stopwatch. I can now initialize and start the RTC but couldn't find any way to stop or reset it during it is running. Hope you might have an input. Thanks.
2 роки тому
Hi. What I would do is keep the rtc running and just read the time on request. Let's say for a stopwatch. I would implement a pushbutton interrupt and when it's pressed I would read the time and store it as "start". I would also save the current "stopwatch state as "start" or "begin". Then on the next press I would save the time into "stop" and calculate the difference. Also give that interrupt higher priority so that from the time of pressing the button and reading the current time takes as little as possible. Should not be that hard to implement. Also, dont forget to read the date as well, even if you won't use it, just call the read function on a struct. The peripheral has an internal locking mechanism that prevents further date and time updates in the registers before both time and date were read. Good idea, but people miss that so the time is never updated again after first read and you might think that you messed something up. Hope this helps.
Hi! Thank you for this tutorial. I want to implement Alarm clock using this same STM32 board and have to interface a buzzer with the board for my project in university. Can you please help me. What are the configurations made for the pins PH0 and PH1 (RCC_OSC_IN/OUT)? Thank you!
Also, I connected serial port via PuTTy but when I run the code, the putty is not showing anything. Did I miss something?
2 роки тому
In the video you can see only external system clock configured. This one is not used for rtc peripheral. What I failed to mention is the clock tree and the rtc is by default connected to internal clock generator. For best results use an external 32k oscillator. You can configure it in the RCC tab. To use serial port, make sure to connect and configure the correct u(s)art peripheral. On the f4 discovery board, uart is not connected to the built in debugger, but some boards do. Make sure to read the board manual. In case of this discovery board I used external usb to serial converter attached to pins seen in the CubeMx window. Let me know if this answered your question.
For those who are not getting the correct year and date, change "sDate.Weekday=22" by "s.Date.Date=22". Then you will get the correct year and date of the month while printing through UART.
3 роки тому+1
Thank you, I have fixed "sDate.Date = 22" and added weekday "sDate.WeekDay = RTC_WEEKDAY_MONDAY" for example.
Amazing video, really useful. I need milisecond precision in my project, but it seems like the values I am getting are decreasing, instead of increasing. I am using an STM32F030R8 with it's onboard RTC. Do you have any ideea why and how I could rectify this?
3 роки тому
Tldr: sadly there is no replacement for a dedicated external crystal with a tight tolerance. That's the nature of internal rc based oscillators. I have seen the difference between internal rtc and external crystal. I think that in that case the internal one was gaining millisecond values, reading it with its wakeup interrupt for highest precision. Using external crystal basically stalled this rising and left values very still even in millisecond precision. I do not know of a feature that would mitigate this problem in rtc peripheral. If you find one I would be grateful for a comment of a solution. Hope this helps.
Can you create a basketball scoreboard with time and shotclock with 74hc595 for 7 segment display.
3 роки тому+1
I would use rtc for time keeping. Maybe use an interrupt triggered by rtc every 1s to decrement the time. You can have a global flag that can disable the countdown when needed. Driver for 7 segment display should not be that difficult to implement, you would just need to use more of them. However I would use (SN)7446 driver that decodes bcd code on 4 bits to 7 segment output. That way you just apply the right combination of bcd pins as they translate to number position and you're set. You will however need at least 4 gpio outputs for each 7 segment display, but should be straightforward to implement. Best of success!
Great tutorial with detailed insights and helpful tips. Thanks a lot!
At 3:05 which clock oscillator you had used ?
I salvaged one from a rtc module that was defective, the circuit is just an inverter with two resistors and two capacitors, look it up online
hey man this is sudhagar i have configured alarm a for every 1 second using internal rtc in stm32 with 32.768 lse crystal.i am receiving some gos string in 0 th second in a minute and im writing it on rtc data register the alarm interruptis not generated for 0 th second why?
Hi Matej. How can we pause and reset the running RTC? I want to implement something like a stopwatch. I can now initialize and start the RTC but couldn't find any way to stop or reset it during it is running. Hope you might have an input. Thanks.
Hi.
What I would do is keep the rtc running and just read the time on request.
Let's say for a stopwatch. I would implement a pushbutton interrupt and when it's pressed I would read the time and store it as "start". I would also save the current "stopwatch state as "start" or "begin". Then on the next press I would save the time into "stop" and calculate the difference.
Also give that interrupt higher priority so that from the time of pressing the button and reading the current time takes as little as possible. Should not be that hard to implement.
Also, dont forget to read the date as well, even if you won't use it, just call the read function on a struct. The peripheral has an internal locking mechanism that prevents further date and time updates in the registers before both time and date were read. Good idea, but people miss that so the time is never updated again after first read and you might think that you messed something up.
Hope this helps.
Hi! Thank you for this tutorial. I want to implement Alarm clock using this same STM32 board and have to interface a buzzer with the board for my project in university. Can you please help me.
What are the configurations made for the pins PH0 and PH1 (RCC_OSC_IN/OUT)? Thank you!
Also, I connected serial port via PuTTy but when I run the code, the putty is not showing anything. Did I miss something?
In the video you can see only external system clock configured. This one is not used for rtc peripheral. What I failed to mention is the clock tree and the rtc is by default connected to internal clock generator. For best results use an external 32k oscillator. You can configure it in the RCC tab.
To use serial port, make sure to connect and configure the correct u(s)art peripheral. On the f4 discovery board, uart is not connected to the built in debugger, but some boards do. Make sure to read the board manual. In case of this discovery board I used external usb to serial converter attached to pins seen in the CubeMx window.
Let me know if this answered your question.
For those who are not getting the correct year and date, change "sDate.Weekday=22" by "s.Date.Date=22". Then you will get the correct year and date of the month while printing through UART.
Thank you, I have fixed "sDate.Date = 22" and added weekday "sDate.WeekDay = RTC_WEEKDAY_MONDAY" for example.
Excellent tutorial!
Amazing video, really useful. I need milisecond precision in my project, but it seems like the values I am getting are decreasing, instead of increasing. I am using an STM32F030R8 with it's onboard RTC.
Do you have any ideea why and how I could rectify this?
Tldr: sadly there is no replacement for a dedicated external crystal with a tight tolerance. That's the nature of internal rc based oscillators.
I have seen the difference between internal rtc and external crystal. I think that in that case the internal one was gaining millisecond values, reading it with its wakeup interrupt for highest precision. Using external crystal basically stalled this rising and left values very still even in millisecond precision.
I do not know of a feature that would mitigate this problem in rtc peripheral. If you find one I would be grateful for a comment of a solution. Hope this helps.
Can you create a basketball scoreboard with time and shotclock with 74hc595 for 7 segment display.
I would use rtc for time keeping. Maybe use an interrupt triggered by rtc every 1s to decrement the time. You can have a global flag that can disable the countdown when needed.
Driver for 7 segment display should not be that difficult to implement, you would just need to use more of them. However I would use (SN)7446 driver that decodes bcd code on 4 bits to 7 segment output. That way you just apply the right combination of bcd pins as they translate to number position and you're set. You will however need at least 4 gpio outputs for each 7 segment display, but should be straightforward to implement.
Best of success!
@ I think this is correct, would you be able to make a tutorial?
I had thought of a ds3231 for rtc
Great video. Could you please make a video about INA219 using STM32 to measure voltage, thank you very much
I already have some similar parts to build a good electronic load, I'll make a video on the project in the future.
Thanks!!
thank you !
thanks