Page 1 of 2
[DONE] Broken RTC on ChibiOS 3
Posted: Fri Jul 04, 2014 4:54 pm
by trunet
I'm trying to use RTC on my STM32F1 but I'm having compilation error:
Code: Select all
Compiling test.c
In file included from /Users/trunet/src/ChibiOS-RT/os/hal/include/rtc.h:97:0,
from /Users/trunet/src/ChibiOS-RT/os/hal/include/hal.h:59,
from /Users/trunet/src/ChibiOS-RT/test/rt/test.c:26:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:169:3: error: unknown type name 'RTCTime'
void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec);
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:170:42: error: unknown type name 'RTCTime'
void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec);
I could't find "typedef RTCTime RTCTime" anywhere, only the struct, so I guess it's missing.
I added and now I'm getting some warning:
Code: Select all
Compiling rtc.c
/Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c: In function 'rtcSetTime':
/Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c:82:3: warning: passing argument 2 of 'rtc_lld_set_time' from incompatible pointer type [enabled by default]
rtcSetTimeI(rtcp, timespec);
^
In file included from /Users/trunet/src/ChibiOS-RT/os/hal/include/rtc.h:97:0,
from /Users/trunet/src/ChibiOS-RT/os/hal/include/hal.h:59,
from /Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c:33:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:174:8: note: expected 'const struct RTCTime *' but argument is of type 'const struct RTCDateTime *'
void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec);
^
/Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c: In function 'rtcGetTime':
/Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c:99:3: warning: passing argument 2 of 'rtc_lld_get_time' from incompatible pointer type [enabled by default]
rtcGetTimeI(rtcp, timespec);
^
In file included from /Users/trunet/src/ChibiOS-RT/os/hal/include/rtc.h:97:0,
from /Users/trunet/src/ChibiOS-RT/os/hal/include/hal.h:59,
from /Users/trunet/src/ChibiOS-RT/os/hal/src/rtc.c:33:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:175:8: note: expected 'struct RTCTime *' but argument is of type 'struct RTCDateTime *'
void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec);
^
Is RTC module incomplete?
Thanks,
Wagner
Re: Broken RTC on ChibiOS 3
Posted: Fri Jul 04, 2014 6:47 pm
by Giovanni
It is not complete yet.
Giovanni
Re: Broken RTC on ChibiOS 3
Posted: Mon Jul 07, 2014 10:46 am
by Giovanni
Hi,
I committed the RTC code it is untested but compiles just fine. In case you want to give it a try please let me know how it works.
Giovanni
Re: Broken RTC on ChibiOS 3
Posted: Tue Jul 08, 2014 2:05 pm
by Legath
Hi Giovanny,
i have the same issue with F4 , as i see it use RTCv2 driver,
but i found RTCTime only in RTCv1,
cat you tell any hack for succesfully compilation?
Re: Broken RTC on ChibiOS 3
Posted: Tue Jul 08, 2014 2:15 pm
by Giovanni
There is no RTCTime in the new driver, only RTCDateTime. You are right that it is RTC_v2, v1 will have to wait until the RTC driver model is "final" or somebody starts porting it.
Giovanni
Re: Broken RTC on ChibiOS 3
Posted: Tue Jul 08, 2014 2:22 pm
by Legath
Hi Giovanny
Code: Select all
grep -rns "RTCTime" *
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:175: * @param[in] timespec pointer to a @p RTCTime structure
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:179:void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec) {
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:193: * @param[in] timespec pointer to a @p RTCTime structure
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:197:void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec) {
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:121:struct RTCTime {
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:169: void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec);
os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:170: void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec);
os/various/chrtclib.c:45: * @param[in] timespec pointer to a @p RTCTime structure
os/various/chrtclib.c:49:static void stm32_rtc_bcd2tm(struct tm *timp, RTCTime *timespec) {
os/various/chrtclib.c:97: * @param[out] timespec pointer to a @p RTCTime structure
os/various/chrtclib.c:101:static void stm32_rtc_tm2bcd(struct tm *timp, RTCTime *timespec) {
os/various/chrtclib.c:148: RTCTime timespec = {0,0,FALSE,0};
os/various/chrtclib.c:150: RTCTime timespec = {0,0,FALSE};
os/various/chrtclib.c:167: RTCTime timespec = {0,0,FALSE,0};
os/various/chrtclib.c:169: RTCTime timespec = {0,0,FALSE};
os/various/chrtclib.c:186: RTCTime timespec = {0,0,FALSE,0};
os/various/chrtclib.c:188: RTCTime timespec = {0,0,FALSE};
os/various/chrtclib.c:209: RTCTime timespec = {0,0,FALSE,0};
os/various/chrtclib.c:211: RTCTime timespec = {0,0,FALSE};
os/various/chrtclib.c:231: RTCTime timespec = {0,0,FALSE,0};
os/various/chrtclib.c:254: RTCTime timespec = {0};
os/various/chrtclib.c:269: RTCTime timespec = {0};
os/various/chrtclib.c:287: RTCTime timespec = {0};
os/various/chrtclib.c:303: RTCTime timespec = {0};
os/various/chrtclib.c:323: RTCTime timespec = {0,0};
so rtclib must be unused now?
Re: Broken RTC on ChibiOS 3
Posted: Tue Jul 08, 2014 2:26 pm
by Giovanni
chrtclib will be reworked or removed entirely, it shall be an optional part anyway, the driver will have everything inside.
Giovanni
Re: Broken RTC on ChibiOS 3
Posted: Tue Jul 08, 2014 11:44 pm
by trunet
Hi Giovanni,
I'm still have problems. I saw that you commited RTCv2 code, but I'm using RTCv1 as I'm using stm32f103... Complete make output is below.
Code: Select all
Compiling rtc_lld.c
In file included from /Users/trunet/src/ChibiOS-RT/os/hal/include/rtc.h:102:0,
from /Users/trunet/src/ChibiOS-RT/os/hal/include/hal.h:60,
from /Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:29:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:169:3: error: unknown type name 'RTCTime'
void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec);
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h:170:42: error: unknown type name 'RTCTime'
void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec);
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c: In function 'rtc_lld_init':
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:166:3: warning: implicit declaration of function 'CORTEX_PRIORITY_MASK' [-Wimplicit-function-declaration]
nvicEnableVector(RTC_IRQn, CORTEX_PRIORITY_MASK(STM32_RTC_IRQ_PRIORITY));
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c: At top level:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:179:1: error: unknown type name 'RTCTime'
void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec) {
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c: In function 'rtc_lld_set_time':
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:184:34: error: request for member 'tv_sec' in something not a structure or union
RTC->CNTH = (uint16_t)(timespec->tv_sec >> 16);
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:185:34: error: request for member 'tv_sec' in something not a structure or union
RTC->CNTL = (uint16_t)(timespec->tv_sec & 0xFFFF);
^
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c: At top level:
/Users/trunet/src/ChibiOS-RT/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c:197:40: error: unknown type name 'RTCTime'
void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec) {
^
make: *** [build/obj/rtc_lld.o] Error 1
It's working with this patch:
Code: Select all
diff --git a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c
index 094b569..9a5664c 100644
--- a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c
@@ -163,7 +163,7 @@ void rtc_lld_init(void){
RTCD1.callback = NULL;
/* IRQ vector permanently assigned to this driver.*/
- nvicEnableVector(RTC_IRQn, CORTEX_PRIORITY_MASK(STM32_RTC_IRQ_PRIORITY));
+ nvicEnableVector(RTC_IRQn, CORTEX_PRIO_MASK(STM32_RTC_IRQ_PRIORITY));
}
/**
diff --git a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h
index 62b74cc..627a4e3 100644
--- a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h
+++ b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.h
@@ -129,6 +129,8 @@ struct RTCTime {
uint32_t tv_msec;
};
+typedef struct RTCTime RTCTime;
+
/**
* @brief Structure representing an RTC alarm time stamp.
*/
Re: Broken RTC on ChibiOS 3
Posted: Mon Aug 18, 2014 4:33 pm
by Michail
Hello again!
Current trunk lost changes made by barthess in revision 6331, so STM32F0xx support was lost again in RTCv2
Code: Select all
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:338:25: error: 'RTC_CR_ALRBE' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:339:33: error: 'RTC_ISR_ALRBWF' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:341:16: error: 'RTC_TypeDef' has no member named 'ALRMBR'
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:343:24: error: 'RTC_CR_ALRBIE' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:367:33: error: 'RTC_TypeDef' has no member named 'ALRMBR'
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:388:23: error: 'RTC_CR_WUTE' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:389:31: error: 'RTC_ISR_WUTWF' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:391:14: error: 'RTC_TypeDef' has no member named 'WUTR'
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:393:22: error: 'RTC_CR_WUTIE' undeclared (first use in this function)
[cc] C:\Work\CoIDE\ChibiOS_3.0_Test\os\hal\ports\STM32\LLD\RTCv2\rtc_lld.c:415:32: error: 'RTC_TypeDef' has no member named 'WUTR'
Re: Broken RTC on ChibiOS 3
Posted: Mon Aug 18, 2014 4:43 pm
by Giovanni
Adding to the TODO list.
Giovanni