2015-01-12 14:42:48 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Eistec AB
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License v2.1. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup board_mulle Eistec Mulle
|
|
|
|
* @ingroup boards
|
|
|
|
* @brief Board specific files for Eistec Mulle IoT boards
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Board specific definitions for the Eistec Mulle IoT board
|
|
|
|
*
|
2015-09-20 13:47:39 +02:00
|
|
|
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
2015-01-12 14:42:48 +01:00
|
|
|
*/
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#ifndef BOARD_H
|
|
|
|
#define BOARD_H
|
2015-01-12 14:42:48 +01:00
|
|
|
|
|
|
|
#include "cpu.h"
|
|
|
|
#include "periph_conf.h"
|
2015-01-28 13:51:45 +01:00
|
|
|
#include "mulle-nvram.h"
|
2016-07-15 19:10:14 +02:00
|
|
|
#include "mtd.h"
|
2015-01-12 14:42:48 +01:00
|
|
|
|
|
|
|
/* Use the on board RTC 32kHz clock for LPTMR clocking. */
|
|
|
|
#undef LPTIMER_CLKSRC
|
|
|
|
/** @brief Clock source for the LPTMR module */
|
|
|
|
#define LPTIMER_CLKSRC LPTIMER_CLKSRC_ERCLK32K
|
|
|
|
|
|
|
|
/** Disable hardware watchdog, for debugging purposes, don't use this on production builds. */
|
|
|
|
#define DISABLE_WDOG 1
|
|
|
|
|
2016-03-20 19:39:37 +01:00
|
|
|
/**
|
|
|
|
* @brief xtimer configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#if 0
|
|
|
|
/* LPTMR xtimer configuration */
|
|
|
|
/* WIP, Use PIT for now */
|
|
|
|
#define XTIMER_DEV (TIMER_LPTMR_DEV(0))
|
|
|
|
#define XTIMER_CHAN (0)
|
|
|
|
/* LPTMR is 16 bits wide */
|
|
|
|
#define XTIMER_WIDTH (16)
|
|
|
|
#define XTIMER_BACKOFF (4)
|
|
|
|
#define XTIMER_ISR_BACKOFF (4)
|
|
|
|
#define XTIMER_OVERHEAD (3)
|
|
|
|
#define XTIMER_HZ (32768ul)
|
|
|
|
#define XTIMER_SHIFT (0)
|
|
|
|
#else
|
|
|
|
/* PIT xtimer configuration */
|
|
|
|
#define XTIMER_DEV (TIMER_PIT_DEV(0))
|
|
|
|
#define XTIMER_CHAN (0)
|
|
|
|
#define XTIMER_WIDTH (32)
|
|
|
|
#define XTIMER_BACKOFF (40)
|
|
|
|
#define XTIMER_ISR_BACKOFF (40)
|
|
|
|
#define XTIMER_OVERHEAD (30)
|
|
|
|
#define XTIMER_HZ (1000000ul)
|
|
|
|
#define XTIMER_SHIFT (0)
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
2015-01-12 14:42:48 +01:00
|
|
|
/**
|
2016-03-11 18:04:26 +01:00
|
|
|
* @brief LED pin definitions and handlers
|
2015-01-12 14:42:48 +01:00
|
|
|
* @{
|
|
|
|
*/
|
2016-03-11 18:04:26 +01:00
|
|
|
#define LED_PORT PTC
|
|
|
|
#define LED0_BIT (15)
|
|
|
|
#define LED1_BIT (14)
|
|
|
|
#define LED2_BIT (13)
|
2015-01-12 14:42:48 +01:00
|
|
|
|
2016-03-11 18:04:26 +01:00
|
|
|
#define LED0_PIN GPIO_PIN(PORT_C, LED0_BIT)
|
|
|
|
#define LED1_PIN GPIO_PIN(PORT_C, LED1_BIT)
|
|
|
|
#define LED2_PIN GPIO_PIN(PORT_C, LED2_BIT)
|
2015-01-12 14:42:48 +01:00
|
|
|
|
2016-03-11 18:04:26 +01:00
|
|
|
#define LED0_ON (BITBAND_REG32(LED_PORT->PSOR, LED0_BIT) = 1)
|
|
|
|
#define LED0_OFF (BITBAND_REG32(LED_PORT->PCOR, LED0_BIT) = 1)
|
|
|
|
#define LED0_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED0_BIT) = 1)
|
2015-01-12 14:42:48 +01:00
|
|
|
|
2016-03-11 18:04:26 +01:00
|
|
|
#define LED1_ON (BITBAND_REG32(LED_PORT->PSOR, LED1_BIT) = 1)
|
|
|
|
#define LED1_OFF (BITBAND_REG32(LED_PORT->PCOR, LED1_BIT) = 1)
|
|
|
|
#define LED1_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED1_BIT) = 1)
|
|
|
|
|
|
|
|
#define LED2_ON (BITBAND_REG32(LED_PORT->PSOR, LED2_BIT) = 1)
|
|
|
|
#define LED2_OFF (BITBAND_REG32(LED_PORT->PCOR, LED2_BIT) = 1)
|
|
|
|
#define LED2_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED2_BIT) = 1)
|
2015-01-12 14:42:48 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
|
|
*/
|
|
|
|
void board_init(void);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2015-05-31 17:15:15 +02:00
|
|
|
* @name Define the interface to the AT86RF212B radio
|
2015-11-13 16:31:14 +01:00
|
|
|
*
|
|
|
|
* @todo Work around missing RESET pin on Mulle v0.6x
|
|
|
|
*
|
|
|
|
* {spi bus, spi speed, cs pin, int pin, reset pin, sleep pin}
|
2015-01-12 14:42:48 +01:00
|
|
|
*/
|
2016-11-08 18:19:12 +01:00
|
|
|
#define AT86RF2XX_PARAMS_BOARD {.spi = SPI_DEV(0), \
|
|
|
|
.spi_clk = SPI_CLK_5MHZ, \
|
2015-11-13 16:31:14 +01:00
|
|
|
.cs_pin = GPIO_PIN(PORT_D, 4), \
|
|
|
|
.int_pin = GPIO_PIN(PORT_B, 9), \
|
|
|
|
.sleep_pin = GPIO_PIN(PORT_E, 6), \
|
|
|
|
.reset_pin = GPIO_PIN(PORT_C, 12)}
|
|
|
|
|
2015-01-12 14:42:48 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @name LIS3DH configuration
|
|
|
|
* @{
|
|
|
|
*/
|
2016-11-08 18:19:12 +01:00
|
|
|
#define LIS3DH_INT1 GPIO_PIN(PORT_C, 18)
|
|
|
|
#define LIS3DH_INT2 GPIO_PIN(PORT_C, 17)
|
|
|
|
#define LIS3DH_CS GPIO_PIN(PORT_D, 0)
|
|
|
|
#define LIS3DH_CLK SPI_CLK_5MHZ
|
|
|
|
#define LIS3DH_SPI SPI_DEV(0)
|
2015-01-12 14:42:48 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name Mulle power control configuration
|
|
|
|
*/
|
|
|
|
/** @{ */
|
2016-11-08 18:19:12 +01:00
|
|
|
#define MULLE_POWER_AVDD GPIO_PIN(PORT_B, 17) /**< AVDD enable pin */
|
|
|
|
#define MULLE_POWER_VPERIPH GPIO_PIN(PORT_D, 7) /**< VPERIPH enable pin */
|
|
|
|
#define MULLE_POWER_VSEC GPIO_PIN(PORT_B, 16) /**< VSEC enable pin */
|
2015-01-12 14:42:48 +01:00
|
|
|
/** @} */
|
|
|
|
|
2015-01-28 13:51:45 +01:00
|
|
|
/**
|
|
|
|
* @name Mulle NVRAM hardware configuration
|
|
|
|
*/
|
|
|
|
/** @{ */
|
2016-11-08 18:19:12 +01:00
|
|
|
#define MULLE_NVRAM_SPI_DEV SPI_DEV(0)
|
|
|
|
#define MULLE_NVRAM_SPI_CLK SPI_CLK_5MHZ
|
|
|
|
#define MULLE_NVRAM_SPI_CS GPIO_PIN(PORT_D, 6) /**< FRAM CS pin */
|
|
|
|
#define MULLE_NVRAM_CAPACITY 512 /**< FRAM size, in bytes */
|
|
|
|
#define MULLE_NVRAM_SPI_ADDRESS_COUNT 1 /**< FRAM addressing size, in bytes */
|
2015-01-28 13:51:45 +01:00
|
|
|
/** @} */
|
|
|
|
|
2016-07-15 19:10:14 +02:00
|
|
|
/**
|
|
|
|
* @name Mulle NOR flash hardware configuration
|
|
|
|
*/
|
|
|
|
/** @{ */
|
|
|
|
#define MULLE_NOR_SPI_DEV SPI_DEV(0)
|
|
|
|
#define MULLE_NOR_SPI_CLK SPI_CLK_5MHZ
|
|
|
|
#define MULLE_NOR_SPI_CS SPI_HWCS(2) /**< Flash CS pin */
|
|
|
|
/** @} */
|
|
|
|
/**
|
|
|
|
* @name MTD configuration
|
|
|
|
*/
|
|
|
|
/** @{ */
|
|
|
|
extern mtd_dev_t *mtd0;
|
|
|
|
#define MTD_0 mtd0
|
|
|
|
/** @} */
|
|
|
|
|
2016-02-18 06:17:45 +01:00
|
|
|
/**
|
|
|
|
* @name Mulle Vchr, Vbat ADC lines
|
|
|
|
*/
|
|
|
|
/** @{ */
|
|
|
|
#define MULLE_VBAT_ADC_LINE ADC_LINE(6)
|
|
|
|
#define MULLE_VCHR_ADC_LINE ADC_LINE(7)
|
|
|
|
/** @} */
|
|
|
|
|
2015-01-12 14:42:48 +01:00
|
|
|
/**
|
|
|
|
* @name K60 clock dividers
|
|
|
|
*/
|
|
|
|
/** @{ */
|
|
|
|
/**
|
|
|
|
* System clock divider setting, the actual hardware register value, see reference manual for details.
|
|
|
|
*/
|
|
|
|
#define CONFIG_CLOCK_K60_SYS_DIV 0x00
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bus clock divider setting, the actual hardware register value, see reference manual for details
|
|
|
|
*/
|
|
|
|
#define CONFIG_CLOCK_K60_BUS_DIV 0x01
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flexbus clock divider setting, the actual hardware register value, see reference manual for details
|
|
|
|
*/
|
|
|
|
#define CONFIG_CLOCK_K60_FB_DIV 0x01
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flash clock divider setting, the actual hardware register value, see reference manual for details
|
|
|
|
*/
|
|
|
|
#define CONFIG_CLOCK_K60_FLASH_DIV 0x03
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* BOARD_H */
|
2015-01-12 14:42:48 +01:00
|
|
|
/** @} */
|