In my opinion the driver should not depend on the library or we would be back to the previous situation which is exactly what I wanted to avoid, the library should be optional.
The realtime counter clock is the system clock.
Giovanni
The RTC driver topic
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The RTC driver topic
Next step performed.
Conversion code moved to rtc.c(h). Now HAL contains all needed functions.
Conversion code moved to rtc.c(h). Now HAL contains all needed functions.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The RTC driver topic
Much nicer this way I think, users will not have to search for extra files.
Giovanni
Giovanni
Re: The RTC driver topic
Giovanni wrote:Much nicer this way
Agree.
I have fixed RTC testhal application for F4x.
Waking up on it works fine in opposite to F1x I still have no ideas why.
Re: The RTC driver topic
Hello Barthess, hi Giovanni!
Think I've stumbled upon a bug in the RTC driver in current trunk on STM32F100C8.
In halInit() function hal_lld_init() calls before rtcInit().
hal_lld_init() calls hal_lld_backup_domain_init(), it calls rtc_lld_set_prescaler(), it calls rtc_acquire_access() and at last it calls rtc_wait_write_completed()
Call stack for my code is:
and in rtc_wait_write_completed() in os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c we can see:
But RTCD1 was not initialised yet! RTCD1.rtc points to NULL and my program hangs here.
Think I've stumbled upon a bug in the RTC driver in current trunk on STM32F100C8.
In halInit() function hal_lld_init() calls before rtcInit().
hal_lld_init() calls hal_lld_backup_domain_init(), it calls rtc_lld_set_prescaler(), it calls rtc_acquire_access() and at last it calls rtc_wait_write_completed()
Call stack for my code is:
Code: Select all
8 rtc_wait_write_completed() rtc_lld.c:74 0x080059aa
7 rtc_acquire_access() rtc_lld.c:87 0x080059d8
6 rtc_lld_set_prescaler() rtc_lld.c:191 0x08005ad0
5 hal_lld_backup_domain_init() hal_lld.c:76 0x08001992
4 hal_lld_init() hal_lld.c:109 0x080019f4
3 halInit() hal.c:66 0x08005b6c
and in rtc_wait_write_completed() in os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c we can see:
Code: Select all
static void rtc_wait_write_completed(void) {
while ((RTCD1.rtc->CRL & RTC_CRL_RTOFF) == 0)
;
}
But RTCD1 was not initialised yet! RTCD1.rtc points to NULL and my program hangs here.
Code: Select all
"RTCD1" {...}
rtc 0x00000000
callback 0x00000000
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The RTC driver topic
I just committed a fix, could you verify functionality? I lack HW for this.
Giovanni
Giovanni
Re: The RTC driver topic
Just looked at the latest change to STM32/lld/rtc2/rtc_lld.c; calls to rtc_enter_init(); and rtc_exit_init(); have been added round the calendar initialisation. These calls are already present earlier and later in the code - should they have been deleted?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The RTC driver topic
It is possible, probably I misunderstood the requested change there, I will look into it again tomorrow.
Giovanni
Giovanni
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 58 guests