I find myself churning through the options trying to find dependencies to subsystems to turn them on.
The top level readme does help - however the general directions are to do it through the menuconfigs and the following README.txt describes it in terms of #defines.
https://bitbucket.org/nuttx/apps/src/master/examples/README.txt
So this is how I enable the subsystem for my test board olimex-STM32-H307 with TTY on Uart2
On my build machine - Ubuntu 15.10
cd tools
./configure.sh olimex-stm32-h407/nsh
cd ..
make menuconfig
Requires RTOS FeaturesàRTOS
Hooksà[*]
Custom board/driver initialization
Requires, Drivers -->Timer Driver Support àRTC Driver Support
.
Debug options
* Enable Debug Features
* Enable Debug Verbose Output
* RTC Debug Output
* Stack Colouration
* Generate Debug Symbols
Application Configurationà Examples
* RTC Alarm driver example (with defaults)
App Config à
NSH LibàDisable
Individual cmds-->
[] Disable date #
turn off disable
If on a board that is missing the 32KHz clock, stm32F4discovery board,
then the RTC can function with another clock
System Type àRTC
clock source LSI or HSI. They don't survive reset for some reason.
make clean
make
and then download it over the ST-LINK.
The output with RTC debugging enabled - using the initial power on time, looks like this
Ideally needs to set up date first but will work without it eg
nsh> date -s "JULY 06 13:45:00 2016"
nsh> alarm 15
alarm_daemon started
alarm_daemon: Running
Oprtc_dumpregs: *** Reading Time:
rtc_dumpregs:
TR: 00003532
rtc_dumpregs:
DR: 00002101
rtc_dumpregs:
CR: 00001100
rtc_dumpregs:
ISR: 00000127
rtc_dumpregs:
PRER: 007f00ff
rtc_dumpregs:
WUTR: 0000ffff
rtc_dumpregs:
CALIBR: 00000000
rtc_dumpregs:
ALRMAR: 80003333
rtc_dumpregs:
ALRMBR: 00000000
rtc_dumpregs:
SHIFTR: 00000000
rtc_dumpregs:
TSTR: 00000000
rtc_dumpregs:
TSDR: 00000000
rtc_dumpregs:
TSSSR: 00000000
rtc_dumpregs:
CALR: 00000000
rtc_dumpregs:
TAFCR: 00000000
rtc_dumpregs: ALRMASSR: 00000000
rtc_dumpregs: ALRMBSSR: 00000000
rtc_dumpregs: MAGICREG: facefeee
rtc_dumpregs: EXTI (RTSR FTSR ISR EVT): 1011
rtc_dumptime: Returning:
rtc_dumptime:
tm_sec: 00000020
rtc_dumptime:
tm_min: 00000023
rtc_dumptime:
tm_hour: 00000000
rtc_dumptime:
tm_mday: 00000001
rtc_dumptime:
tm_mon: 00000000
rtc_dumptime:
tm_year: 00000064
rtc_dumptime: New alarm time:
rtc_dumptime:
tm_sec: 00000030
rtc_dumptime:
tm_min: 00000023
rtc_dumptime:
tm_hour: 00000000
rtc_dumptime:
tm_mday: 00000001
rtc_dumptime:
tm_mon: 00000000
rtc_dumptime:
tm_year: 00000064
irtc_dumpregs: *** Set AlarmA:
irtc_dumpregs: *** Set AlarmA:
rtc_dumpregs:
TR: 00003532
rtc_dumpregs:
DR: 00002101
rtc_dumpregs:
CR: 00001100
rtc_dumpregs:
ISR: 00000027
rtc_dumpregs:
PRER: 007f00ff
rtc_dumpregs:
WUTR: 0000ffff
rtc_dumpregs:
CALIBR: 00000000
rtc_dumpregs:
ALRMAR: 80003548
rtc_dumpregs:
ALRMBR: 00000000
rtc_dumpregs:
SHIFTR: 00000000
rtc_dumpregs:
TSTR: 00000000
rtc_dumpregs:
TSDR: 00000000
rtc_dumpregs:
TSSSR: 00000000
rtc_dumpregs:
CALR: 00000000
rtc_dumpregs:
TAFCR: 00000000
rtc_dumpregs: ALRMASSR: 00000000
rtc_dumpregs: ALRMBSSR: 00000000
rtc_dumpregs: MAGICREG: facefeee
rtc_dumpregs: EXTI (RTSR FTSR ISR EVT): 1011
ng /dev/rtc0
rtchw_set_alrmar:
TR: 00003532 ALRMAR: 80003548
Alarm set in 15 seconds
nsh>
(then when the alarm goes off)
rtc_dumpregs: *** Reading Time:
(then when the alarm goes off)
rtc_dumpregs: *** Reading Time:
rtc_dumpregs:
TR: 00003548
rtc_dumpregs:
DR: 00002101
rtc_dumpregs:
CR: 00001100
rtc_dumpregs:
ISR: 00000127
rtc_dumpregs:
PRER: 007f00ff
rtc_dumpregs:
WUTR: 0000ffff
rtc_dumpregs:
CALIBR: 00000000
rtc_dumpregs:
ALRMAR: 80003548
rtc_dumpregs:
ALRMBR: 00000000
rtc_dumpregs:
SHIFTR: 00000000
rtc_dumpregs:
TSTR: 00000000
rtc_dumpregs:
TSDR: 00000000
rtc_dumpregs:
TSSSR: 00000000
rtc_dumpregs:
CALR: 00000000
rtc_dumpregs:
TAFCR: 00000000
rtc_dumpregs: ALRMASSR: 00000000
rtc_dumpregs: ALRMBSSR: 00000000
rtc_dumpregs: MAGICREG: facefeee
rtc_dumpregs: EXTI (RTSR FTSR ISR EVT): 1011
rtc_dumptime: Returning:
rtc_dumptime:
tm_sec: 00000030
rtc_dumptime:
tm_min: 00000023
rtc_dumptime:
tm_hour: 00000000
rtc_dumptime:
tm_mday: 00000001
rtc_dumptime:
tm_mon: 00000000
rtc_dumptime:
tm_year: 00000064
alarm_demon: alarm 0 received
Nice post Neil!
ReplyDeleteI'm testing RTC and PM in the STM32F4Discovery.
This board comes with not 32KHz crystal, then I soldered a crystal on it. It is strange ST put a 32KHz crystal on STM32VLDiscovery but doesn't put it on STM32F4Discovery.
Glad you liked it. STM32F4Discovery seems to be missing a number of hardware features, I guess its only an introduction. The STM32-H407 is for real world situations
ReplyDelete