update nucleo l476 config and code to support the RTC and the alarms functionality

This commit is contained in:
ziggurat29 2016-05-07 12:03:18 -05:00
parent 48fc8b9dd7
commit 1e5910a99d
3 changed files with 68 additions and 8 deletions

View File

@ -69,6 +69,7 @@ CONFIG_DEBUG_LIB=y
CONFIG_DEBUG_LEDS=y
CONFIG_DEBUG_ANALOG=y
CONFIG_DEBUG_GPIO=y
# CONFIG_DEBUG_RTC is not set
CONFIG_DEBUG_SPI=y
CONFIG_ARCH_HAVE_STACKCHECK=y
# CONFIG_STACK_COLORATION is not set
@ -290,6 +291,9 @@ CONFIG_STM32L4_FIREWALL=y
CONFIG_STM32L4_FLASH_PREFETCH=y
CONFIG_STM32L4_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
# CONFIG_ARCH_BOARD_STM32L4_CUSTOM_CLOCKCONFIG is not set
CONFIG_STM32L4_RTC_LSECLOCK=y
# CONFIG_STM32L4_RTC_LSICLOCK is not set
# CONFIG_STM32L4_RTC_HSECLOCK is not set
CONFIG_STM32L4_SAI1PLL=y
# CONFIG_STM32L4_SAI2PLL is not set
@ -377,7 +381,14 @@ CONFIG_NSH_MMCSDMINOR=0
#
# Board-Specific Options
#
# CONFIG_LIB_BOARDCTL is not set
CONFIG_LIB_BOARDCTL=y
# CONFIG_BOARDCTL_RESET is not set
# CONFIG_BOARDCTL_UNIQUEID is not set
# CONFIG_BOARDCTL_TSCTEST is not set
# CONFIG_BOARDCTL_ADCTEST is not set
# CONFIG_BOARDCTL_PWMTEST is not set
# CONFIG_BOARDCTL_GRAPHICS is not set
# CONFIG_BOARDCTL_IOCTL is not set
#
# RTOS Features
@ -396,9 +407,6 @@ CONFIG_USEC_PER_TICK=10000
# CONFIG_SYSTEM_TIME64 is not set
# CONFIG_CLOCK_MONOTONIC is not set
# CONFIG_JULIAN_TIME is not set
CONFIG_START_YEAR=2014
CONFIG_START_MONTH=5
CONFIG_START_DAY=5
CONFIG_MAX_WDOGPARMS=2
CONFIG_PREALLOC_WDOGS=8
CONFIG_WDOG_INTRESERVE=1
@ -517,7 +525,13 @@ CONFIG_SPI_EXCHANGE=y
# Timer Driver Support
#
# CONFIG_TIMER is not set
# CONFIG_RTC is not set
CONFIG_RTC=y
CONFIG_RTC_DATETIME=y
CONFIG_RTC_ALARM=y
CONFIG_RTC_NALARMS=2
CONFIG_RTC_DRIVER=y
CONFIG_RTC_IOCTL=y
# CONFIG_RTC_EXTERNAL is not set
# CONFIG_WATCHDOG is not set
# CONFIG_ANALOG is not set
# CONFIG_AUDIO_DEVICES is not set
@ -755,6 +769,11 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
#
# Examples
#
CONFIG_EXAMPLES_ALARM=y
CONFIG_EXAMPLES_ALARM_PRIORITY=100
CONFIG_EXAMPLES_ALARM_STACKSIZE=2048
CONFIG_EXAMPLES_ALARM_DEVPATH="/dev/rtc0"
CONFIG_EXAMPLES_ALARM_SIGNO=1
# CONFIG_EXAMPLES_CHAT is not set
# CONFIG_EXAMPLES_CONFIGDATA is not set
# CONFIG_EXAMPLES_CPUHOG is not set
@ -813,6 +832,7 @@ CONFIG_EXAMPLES_NSAMPLES=8
# CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_WEBSERVER is not set
# CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_USBTERM is not set
# CONFIG_EXAMPLES_WATCHDOG is not set
@ -944,7 +964,7 @@ CONFIG_NSH_FILEIOSIZE=512
#
CONFIG_NSH_CONSOLE=y
# CONFIG_NSH_ALTCONDEV is not set
# CONFIG_NSH_ARCHINIT is not set
CONFIG_NSH_ARCHINIT=y
# CONFIG_NSH_LOGIN is not set
# CONFIG_NSH_CONSOLE_LOGIN is not set

View File

@ -52,7 +52,15 @@
************************************************************************************/
/* Configuration ********************************************************************/
#define HAVE_RTC_DRIVER 1
#define HAVE_MMCSD 1
/* Check if we can support the RTC driver */
#if !defined(CONFIG_RTC) || !defined(CONFIG_RTC_DRIVER)
# undef HAVE_RTC_DRIVER
#endif
#if !defined(CONFIG_STM32_SDIO) || !defined(CONFIG_MMCSD) || \
!defined(CONFIG_MMCSD_SDIO)
# undef HAVE_MMCSD

View File

@ -55,6 +55,11 @@
#include "nucleo-l476rg.h"
#ifdef HAVE_RTC_DRIVER
# include <nuttx/timers/rtc.h>
# include "stm32l4_rtc.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -83,9 +88,12 @@ void up_netinitialize(void)
int board_app_initialize(void)
{
#if defined(HAVE_MMCSD) || defined(CONFIG_AJOYSTICK)
int ret;
#ifdef HAVE_RTC_DRIVER
FAR struct rtc_lowerhalf_s *rtclower;
#endif
int ret;
(void)ret;
/* Configure CPU load estimation */
@ -93,6 +101,30 @@ int board_app_initialize(void)
cpuload_initialize_once();
#endif
#ifdef HAVE_RTC_DRIVER
/* Instantiate the STM32L4 lower-half RTC driver */
rtclower = stm32l4_rtc_lowerhalf();
if (!rtclower)
{
sdbg("ERROR: Failed to instantiate the RTC lower-half driver\n");
return -ENOMEM;
}
else
{
/* Bind the lower half driver and register the combined RTC driver
* as /dev/rtc0
*/
ret = rtc_initialize(0, rtclower);
if (ret < 0)
{
sdbg("ERROR: Failed to bind/register the RTC driver: %d\n", ret);
return ret;
}
}
#endif
#ifdef HAVE_MMCSD
/* First, get an instance of the SDIO interface */