mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
SAMV71-XULT: Add support for an external I2C RTC
This commit is contained in:
@@ -35,6 +35,10 @@ address 0x00000000, but trying to step through with AtmelStudio 7 results
|
|||||||
in uninterpretble behavior. Using the Segger J-Link, I get errors trying
|
in uninterpretble behavior. Using the Segger J-Link, I get errors trying
|
||||||
to reset and halt the board so I am unable to use that debugger either.
|
to reset and halt the board so I am unable to use that debugger either.
|
||||||
|
|
||||||
|
WARNING: This README derives heavily from the SAMV71-XULT README file and
|
||||||
|
may still contain some logic that pertains only to that board. This is a
|
||||||
|
work in progress
|
||||||
|
|
||||||
See also configs/samv71-xult/README.txt
|
See also configs/samv71-xult/README.txt
|
||||||
|
|
||||||
Serial Console
|
Serial Console
|
||||||
|
|||||||
@@ -70,6 +70,13 @@
|
|||||||
# include "sam_progmem.h"
|
# include "sam_progmem.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_RTC_DSXXXX
|
||||||
|
# include <nuttx/clock.h>
|
||||||
|
# include <nuttx/i2c.h>
|
||||||
|
# include <nuttx/timers/ds3231.h>
|
||||||
|
# include "sam_twihs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ROMFS
|
#ifdef HAVE_ROMFS
|
||||||
# include <arch/board/boot_romfsimg.h>
|
# include <arch/board/boot_romfsimg.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -110,12 +117,42 @@ int sam_bringup(void)
|
|||||||
#if defined(HAVE_S25FL1) || defined(HAVE_PROGMEM_CHARDEV)
|
#if defined(HAVE_S25FL1) || defined(HAVE_PROGMEM_CHARDEV)
|
||||||
FAR struct mtd_dev_s *mtd;
|
FAR struct mtd_dev_s *mtd;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_RTC_DSXXXX
|
||||||
|
FAR struct i2c_dev_s *i2c;
|
||||||
|
#endif
|
||||||
#if defined(HAVE_S25FL1_CHARDEV) || defined(HAVE_PROGMEM_CHARDEV)
|
#if defined(HAVE_S25FL1_CHARDEV) || defined(HAVE_PROGMEM_CHARDEV)
|
||||||
char blockdev[18];
|
char blockdev[18];
|
||||||
char chardev[12];
|
char chardev[12];
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
#ifdef HAVE_RTC_DSXXXX
|
||||||
|
/* Get an instance of the TWIHS0 I2C interface */
|
||||||
|
|
||||||
|
i2c = up_i2cinitialize(DSXXXX_TWI_BUS);
|
||||||
|
if (i2c == NULL)
|
||||||
|
{
|
||||||
|
SYSLOG("ERROR: up_i2cinitialize(%d) failed\n", DSXXXX_TWI_BUS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Use the I2C interface to initialize the DSXXXX timer */
|
||||||
|
|
||||||
|
ret = dsxxxx_rtc_initialize(i2c);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
SYSLOG("ERROR: dsxxxx_rtc_initialize() failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Synchronize the system time to the RTC time */
|
||||||
|
|
||||||
|
clock_synchronize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MACADDR
|
#ifdef HAVE_MACADDR
|
||||||
/* Read the Ethernet MAC address from the AT24 FLASH and configure the
|
/* Read the Ethernet MAC address from the AT24 FLASH and configure the
|
||||||
* Ethernet driver with that address.
|
* Ethernet driver with that address.
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
#define HAVE_PROGMEM_CHARDEV 1
|
#define HAVE_PROGMEM_CHARDEV 1
|
||||||
#define HAVE_WM8904 1
|
#define HAVE_WM8904 1
|
||||||
#define HAVE_AUDIO_NULL 1
|
#define HAVE_AUDIO_NULL 1
|
||||||
|
#define HAVE_RTC_DSXXXX 1
|
||||||
|
|
||||||
/* HSMCI */
|
/* HSMCI */
|
||||||
/* Can't support MMC/SD if the card interface is not enabled */
|
/* Can't support MMC/SD if the card interface is not enabled */
|
||||||
@@ -298,6 +299,27 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DS3231/DS1307 RTC
|
||||||
|
*
|
||||||
|
* For testing purposes, I have connected a Maximum Integrated I2C RTC TWIHS0
|
||||||
|
* (available on either EXT or EXT2 pins 11 and 12).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SAMV7_TWIHS0) || !defined(CONFIG_RTC_DSXXXX)
|
||||||
|
# undef HAVE_RTC_DSXXXX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_RTC) || !defined(CONFIG_RTC_DATETIME)
|
||||||
|
# undef HAVE_RTC_DSXXXX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_RTC_DSXXXX
|
||||||
|
/* The DS3231/1307 RTC communicates on TWI0, I2C address 0x68 */
|
||||||
|
|
||||||
|
# define DSXXXX_TWI_BUS 0
|
||||||
|
# define DSXXXX_I2C_ADDRESS 0x68
|
||||||
|
#endif
|
||||||
|
|
||||||
/* SAMV71-XULT GPIO Pin Definitions *************************************************/
|
/* SAMV71-XULT GPIO Pin Definitions *************************************************/
|
||||||
|
|
||||||
/* Ethernet MAC.
|
/* Ethernet MAC.
|
||||||
|
|||||||
Reference in New Issue
Block a user