Тёмный

STM32F4 Discovery board - Keil 5 IDE with CubeMX: Tutorial 20 - Real Time Clock (RTC) 

Mutex Embedded
Подписаться 22 тыс.
Просмотров 38 тыс.
50% 1

This video shows you how to use RTC (Real Time Clock) on the STM32 series (STM32F4 Discovery in my case):
1. Using CubeMX + HAL Libraries.
2. Only HAL Libraries (Without CubeMX).
Source code (as a text file):
drive.google.com/open?id=1MLs...

Наука

Опубликовано:

 

4 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 62   
@serhatozcan3624
@serhatozcan3624 6 лет назад
Mohammed keep going my brother. You are very helpful. Thank you very much!
@diegoriquelme7935
@diegoriquelme7935 6 лет назад
Excellent buddy! Thanks
@BenBilesBB-box
@BenBilesBB-box 5 лет назад
especially like the non cube part of the video! thanks!
@anandakrishnannair
@anandakrishnannair 2 года назад
Thank you for your help sir.
@anagutierrez9265
@anagutierrez9265 5 лет назад
Thank you so much!
@rwbazillion
@rwbazillion 6 лет назад
Did this one, did notice that the sTime, sDate, and sAlarm were local in static void MX_RTC_Init(void). You moved them as global variables and I had to do the same so you can use them outside the function. If people want to change something and regenerate the code they need to be aware the code generator will make those variables again giving you two definitions. It compiled fine but don't like the same variable in a local function and as global. I made mine static, but just for people to be aware of it. Thanks for thee tutorials, these are really helpful. I'm using a nucleo-F767ZI and the tutorials are helpful. I'm looking to possibly take your LCD driver code and make a somewhat platform independent driver for using the 16x2 LCD on not only a STM but also a Renesas eval board. Just a thought right now but it would be cool to do.
@mutexembedded2206
@mutexembedded2206 6 лет назад
Hi mate, Agree! And please go ahead and play with the library.
@arifkhan-xs5nk
@arifkhan-xs5nk 4 года назад
how can i use lcd and i2c to show the time and date . i tried but i can see only weird characters on the lcd
@buihao5770
@buihao5770 4 года назад
hi bro. Thank you so much.
@mohamadchamrami
@mohamadchamrami 4 года назад
Thank you
@aliefiandiojulianto2712
@aliefiandiojulianto2712 4 года назад
thanks bro
@alirezaasadi9109
@alirezaasadi9109 4 года назад
very useful
@ebl8975
@ebl8975 4 года назад
Hi yaqoob please make a series of vedios on IOT protocols(http, MQTT, TCP/IP), and wifi and Bluetooth interfacing. Thanks
@LuizFernandoPintodeOliveira
@LuizFernandoPintodeOliveira 6 лет назад
Hi friend, I would like to know how to program using the standard library for STM32, rather than the HALL library?
@fernando.liozzi.41878
@fernando.liozzi.41878 4 года назад
Hello, is there any way to configure the RTCC when programming the STM32 ?, in compilers like MPLABX, we have the macros __TIME__ and __DATE__ that take the system time at compile time, and we can parsing to configure the rtcc. Thanks!
@conkerkh
@conkerkh 6 лет назад
FYI Synch prediv should be set to 249 for 32k LSI
@LordEvilSeph
@LordEvilSeph 5 лет назад
What is the lowest power mode you can put the stm32 in that keeps RTC on and it is possible to wake up the micro with external interrupt? if it is important it is for stm32L0 series. Thanks
@LordEvilSeph
@LordEvilSeph 5 лет назад
I think I figured it out, it is STOP state.
@atefbenattia913
@atefbenattia913 5 лет назад
Hello Mohamed, How can I show time on lcd screen instead of stmstudio? I have already seen your video about the lcd1602 and I have the library you shared with us. please respond me soon.
@mdhebling
@mdhebling 4 года назад
Hi Mohamed I'm using your LCD1602 library to write informations on LCD. I watched your video about RTC and I liked so much. Now i'm trying write the RTC variables like so date, month, year, hour, minute and second using your LCD1602 library. This informations are displayed on LCD, but the actualization this information don't occur. I'm using a STM32F4 Dicovery board that have a ST32F407VGT microcontroler. In this board the VBAT pin is connected to VDD 3.3V. Only to clarify, I'm using this "subvariables": sDate.Date for date sDate.Month for month sDate.Year for year sTime.Hours for hours sTime.Minutes for minute sTime.Seconds for second What I can do to solve this problem? Please, could you help me? I'm waiting your answer, thanks.
@bysanilikhitha4265
@bysanilikhitha4265 6 лет назад
I take this video as reference to understand the concept of RTC but I wanted to know to use RTC to time stamp data...Could you guide me for this
@mutexembedded2206
@mutexembedded2206 6 лет назад
Hi, Is it just reading the time and date that correspond to acquiring a sample of data? It is simple enough, you just need to schedule a Time and Data reading at the acquisition instance, then can do all the fun bits (e.g. creating a comma separated values CSV file where time is one of the columns). Hope this helps. Good luck
@civilizeddiscussion697
@civilizeddiscussion697 6 лет назад
time and date initialization in cubemx fail because you set the year wrong, it must be 0-99. it is very helpful btw
@mutexembedded2206
@mutexembedded2206 6 лет назад
tory utama Hi Tory, Awesome! I will try that.
@rwbazillion
@rwbazillion 6 лет назад
I was going to say that, I observed in the video he wrote 2017, but it only allows 0-99. I did the same mistake as well.
@mutexembedded2206
@mutexembedded2206 6 лет назад
rwbazillion Well spotted .. you're right :)
@sadashivkamath
@sadashivkamath 5 лет назад
RTC gets re-initialized to old value when System Reset occurs. Have tried alternate scheme on this? Resetting the RTC: The calendar shadow registers (RTC_SSR, RTC_TR and RTC_DR) and some bits of the RTC status register (RTC_ISR) are reset to their default values by all available system reset sources. On the contrary, the following registers are resetted to their default values by a backup domain reset and are not affected by a system reset: the RTC current calendar registers, the RTC control register (RTC_CR), the prescaler register (RTC_PRER), the RTC calibration registers (RTC_CALIBR or RTC_CALR), the RTC shift register (RTC_SHIFTR), the RTC timestamp registers (RTC_TSSSR, RTC_TSTR and RTC_TSDR), the RTC tamper and alternate function configuration register (RTC_TAFCR), the RTC backup registers (RTC_BKPxR), the wakeup timer register (RTC_WUTR), the Alarm A and Alarm B registers RTC_ALRMASSR / RTC_ALRMAR and RTC_ALRMBSSR/RTC_ALRMBR).
@vambans2412
@vambans2412 6 лет назад
Excellent video thank u.can I use this in shut down mode n generate alarm every 5 minute n wakeup.do u have any suggestions.
@mutexembedded2206
@mutexembedded2206 6 лет назад
Interesting one! I have not tried this before. But I came across it in the reference manual on page 787, there it explains how to use 'Periodic Auto-Wakeup'.
@michlin19710825
@michlin19710825 4 года назад
dear sir, why don't we need to call HAL_NVIC_EnableIRQ for SysTick as we do for RTC timer? Is it activated by default, or is configured somewhere else in the program? please advise. thanks.
@mutexembedded2206
@mutexembedded2206 4 года назад
There so many things done in background by CubeMX that you will miss if you don't train from scratch on STM32 without CubeMX.
@acocrw5808
@acocrw5808 6 лет назад
Ok i have battery but when CPU restart . Rtc init () again. Android s.time set again value. İ font want this.
@ilayarajamurugan9168
@ilayarajamurugan9168 4 года назад
if i'm choose external crystal my controller not show the time plz help me
@dilipkumarm2008
@dilipkumarm2008 6 лет назад
Good one bruv.. subscribed to ur channel.. I have a case here . Can u explain what can be done.. I need rtc to wake up at certain time and usher GSM and GPS module (which is in deep sleep) for sending data and after that it again need to go to sleep.. like @9am module should power on and send data and again goes to sleep.. repeat .
@mutexembedded2206
@mutexembedded2206 6 лет назад
Hi Kumar, You can use Alarm function to trigger your devices, on the specified time. hope this helps
@farouk0161
@farouk0161 6 лет назад
Cube mx set the timeand date for me. but STM studio doesnt show the sDate and sTime variables. Can someone help me pls? i followed the steps. thank you
@mutexembedded2206
@mutexembedded2206 6 лет назад
Farouk 01 Mentioned that at 4:45
@viraliot8315
@viraliot8315 4 года назад
RTC lagging 8sec for every 10 min, is there is any way to calibrate rtc for more accuracy
@mutexembedded2206
@mutexembedded2206 4 года назад
Hi, Yes, I mentioned that if you use internal oscillator, it will not be accurate, need to use 32.768 KHz external LSE oscillator. The STM32 F4 Discovery boards does not come equipped with one, can put one yourself there is an SMD pad free for LSE. ot just use another STM board with an LSE. Thanks
@civilizeddiscussion697
@civilizeddiscussion697 6 лет назад
can you explain generally what is the difference if i use external clock such as ds1302? and can i add coin cel battery with internal clock? i need it for my data logger project, or you have any better option?
@mutexembedded2206
@mutexembedded2206 6 лет назад
tory utama Hi tory, If you wanna use STM32 RTC, you need to have an external Low Speed oscillator, some STM boards comes with that built in, some don't like the STM32F4 DISCOVERY. For RTC battery pin on stm32, read this article: www.eletel.p.lodz.pl/mipsa/index.php/en/projects/151-stm32f4-discovery-rtc-hack
@civilizeddiscussion697
@civilizeddiscussion697 6 лет назад
MYaqoobEmbedded i use Stm32f4discovery. Do you have any tips for my data logger project? Note that it is my first time doing microcontroller project and my teacher force me to use stm32 instead of arduino. I will use can bus too for communication with other projects.
@Filipx87page
@Filipx87page 2 года назад
@@mutexembedded2206In my opinion, I would say that the internal RTC is more for advanced users, because a setting bug can lead to a complete freezing of the microcontroller (and it doesn't have to be right away, but maybe with a dead battery) and only help to full erase the chip and reupload the firmware. For less skilled geeks, an external circuit is a better and safer choice.
@mutexembedded2206
@mutexembedded2206 2 года назад
@@Filipx87page I agree with what you mentioned, it is true that ST could have done way better job, but you can still do a lot with the built-in RTC.
@amandioreal2293
@amandioreal2293 5 лет назад
Hello, I have tried to implement RTC code. However my RTC doen't count. When a try to catch the RTC time he returns the same value every time
@saitejapabbisetti6547
@saitejapabbisetti6547 4 года назад
Amandio Real I also have the same problem. Is it resolved? Please let me know how you resolved it
@acocrw5808
@acocrw5808 6 лет назад
hi my friends. ı did that its work but when restart cpu , rtc start begin time.do u know how can ı do it.
@mutexembedded2206
@mutexembedded2206 6 лет назад
İsmail Erol Coder Hi, Need to connect a battery through Vbat pin to keep rtc running
@acocrw5808
@acocrw5808 5 лет назад
No no I mean, I'm using stm32f407vet6 . This card has a internal rtc. When I set date and time it's working good with battery . But when I reset CPU manual. And then I saw time is back to set again. Hope I explain to you my friend. :)
@mutexembedded2206
@mutexembedded2206 5 лет назад
@@acocrw5808 Hi, I see what you mean, you need to set time and date once, delete set Time/Date code and re-upload code. All while battery is connected. Then just keep reading RTC.
@amandioreal2293
@amandioreal2293 5 лет назад
I found the problem. I must call GetTime and then GetDate.
@mutexembedded2206
@mutexembedded2206 5 лет назад
Yes, you do. Good
@madhuritrivedia
@madhuritrivedia 6 лет назад
hii. i tried this but my time doesn't increments even after the subsecond are incrementing.. can u please help.?
@mutexembedded2206
@mutexembedded2206 6 лет назад
Madhuri Trivedia Hi, might be just a little thing you forgot.. Go over the code again, I'm sure u will figure it out.
@harshaldhake8227
@harshaldhake8227 6 лет назад
hi, we checked and followed u step by step..still isn't working..
@mutexembedded2206
@mutexembedded2206 6 лет назад
Are you using the same board?
@harshaldhake8227
@harshaldhake8227 6 лет назад
yes stm32f4 discovery board
@harshaldhake8227
@harshaldhake8227 6 лет назад
the clock configurations are also same...
@Graham1904
@Graham1904 4 года назад
Using a "virgin" build I get fatal errors "os_tick.h: No such file or directory" :(
@wajihtouhami2162
@wajihtouhami2162 6 месяцев назад
mohamed where is the code why why !!
Далее
FARUX RAIMOV AVJIGA CHIQDI - JAVOHIR🔥
01:01
Просмотров 916 тыс.
Physicists Claim They Can Send Particles Into the Past
7:21
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
Просмотров 871 тыс.
A beautiful math question for advanced students
10:38
I created the WORST chess AI (worse than worstfish)
7:18
Rust and RAII Memory Management - Computerphile
24:22
Просмотров 218 тыс.
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
Просмотров 159 тыс.