diff --git a/boards/microduino-corerf/Makefile b/boards/microduino-corerf/Makefile new file mode 100644 index 0000000000..3134740b39 --- /dev/null +++ b/boards/microduino-corerf/Makefile @@ -0,0 +1,5 @@ +MODULE = board + +DIRS = $(RIOTBOARD)/common/atmega + +include $(RIOTBASE)/Makefile.base diff --git a/boards/microduino-corerf/Makefile.dep b/boards/microduino-corerf/Makefile.dep new file mode 100644 index 0000000000..3d1c295b9b --- /dev/null +++ b/boards/microduino-corerf/Makefile.dep @@ -0,0 +1 @@ +USEMODULE += boards_common_atmega diff --git a/boards/microduino-corerf/Makefile.features b/boards/microduino-corerf/Makefile.features new file mode 100644 index 0000000000..a0113ad819 --- /dev/null +++ b/boards/microduino-corerf/Makefile.features @@ -0,0 +1,13 @@ +CPU = atmega128rfa1 + +# This board is based on an atmega CPU, thus import the features from it +FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_gpio periph_gpio_irq +FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_timer +FEATURES_PROVIDED += periph_uart + +# Put defined MCU peripherals here (in alphabetical order) +# Peripherals are defined in common/arduino-atmega/Makefile.features +# Add only additional Peripherals diff --git a/boards/microduino-corerf/Makefile.include b/boards/microduino-corerf/Makefile.include new file mode 100644 index 0000000000..83ec708b9a --- /dev/null +++ b/boards/microduino-corerf/Makefile.include @@ -0,0 +1,17 @@ +# configure the terminal program +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +BAUD ?= 57600 +include $(RIOTMAKE)/tools/serial.inc.mk + +# PROGRAMMER defaults to UM232H which is a FT232H breakout board +# externally connected using wires +PROGRAMMER_MICRODUINO_CORERF ?= UM232H +PROGRAMMER ?= $(PROGRAMMER_MICRODUINO_CORERF) + +# We don't use a bootloader +BOOTLOADER_SIZE ?= 0 +ROM_RESERVED ?= $(BOOTLOADER_SIZE) + +include $(RIOTMAKE)/tools/avrdude.inc.mk +include $(RIOTBOARD)/common/atmega/Makefile.include diff --git a/boards/microduino-corerf/doc.txt b/boards/microduino-corerf/doc.txt new file mode 100644 index 0000000000..7a2d2f55ea --- /dev/null +++ b/boards/microduino-corerf/doc.txt @@ -0,0 +1,82 @@ +/** + * @defgroup boards_microduino-corerf Microduino CoreRF + * @ingroup boards + * @brief Support for the Microduino CoreRF board + +# Hardware +## Pinout + +![corerf-pinout](https://wiki.microduinoinc.com/images/d/df/RF%E5%BC%95%E8%84%9A.jpg) + +Warning: Unlike on other ATmega MCUs, the GPIOs are not 5V tolerant. + +## Board +The board is just a breakout for the ATmega128RFA1 MCU. + +## MCU Details +| MCU | ATmega128RFA1 | +|:------------- -|:--------------------------| +| Family | ATmega | +| Vendor | Atmel | +| Package | QFN/MLF | +| SRAM | 16K | +| Flash | 128K | +| EEPROM | 4K | +| Core Frequency | 8MHz (16MHz no power save mode) | +| Oscillators | 32.768 kHz & 16 MHz | +| Timerr | 6 ( 2x8bit & 4x16bit ) | +|Analog Comparator| 1 | +| ADCs | 1x 15 channel 6 to 12-bit | +| USARTs | 2 | +| SPIs | 3 (1 SPI & 2 USART SPI) | +| I2Cs | 1 (called TWI) | +| Vcc | 1.8V - 3.6V | +| Datasheet / Reference Manual | [Datasheet and Reference Manual](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8266-MCU_Wireless-ATmega128RFA1_Datasheet.pdf) | +| Board Manual | [Wiki Page](https://wiki.microduinoinc.com/Microduino-Module_CoreRF) | + +The MCU comes with a 2.4 GHz IEEE 802.15.4 radio that is compatible with the +Atmel AT86RF23x line of transceivers with the only difference being that it is +not being accessed over an SPI bus, but instead the radio registers are directly +mapped into memory. + +# Flashing RIOT +Flashing RIOT on the CoreRF is done using the SPI method. +Using a cheap FT232H breakout board, connect the board as follows: + +| FT232H | Microduino CoreRF | +|:------ |:----------------- | +| D0 | D13 (SCK) | +| D1 | D11 (MOSI) | +| D2 | D12 (MISO) | +| D3 | RST (Reset) | +| 3.3V | 3.3V | +| GND | GND | + +Now you can simply type + +`make flash BOARD=microduino-corerf` + +This should take care of everything! + +You will need a separate adapter for UART: + +| FT232R | Microduino CoreRF | +|:------ |:----------------- | +| TX | D0 | +| RX | D1 | + +# Troubleshooting + +## Using the external crystal oscillator (Transceiver Crystal Oscillator) and deep sleep + +When the external crystal oscillator is used as system clock and the device is put into deep sleep mode it seems that +the clocks for all peripherals are enabled and set to the smallest divider (highest frequency). This leads to a higher +power consumption. When the device should be put into deep sleep it is recommended to use the internal RC oscillator +as system clock source. + +## Pin Change Interrupts + +More pins can be used for hardware interrupts using the Pin Change +Interrupt feature. See @ref boards_common_atmega for details. + + */ diff --git a/boards/microduino-corerf/include/board.h b/boards/microduino-corerf/include/board.h new file mode 100644 index 0000000000..3434d6c60e --- /dev/null +++ b/boards/microduino-corerf/include/board.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 Benjamin Valentin + * + * 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. + */ + +/** + * @ingroup boards_microduino-corerf + * @{ + * + * @file + * @brief Board specific definitions for the Microduino CoreRF board. + * + * @author Benjamin Valentin + */ + +#ifndef BOARD_H +#define BOARD_H + +#include "cpu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name baudrate for STDIO terminal + * + * @{ + */ +#ifndef STDIO_UART_BAUDRATE +#define STDIO_UART_BAUDRATE (57600U) /**< Sets Baudrate for e.g. Shell */ +#endif +/** @} */ + +/** + * @name xtimer configuration values + * @{ + */ +#define XTIMER_WIDTH (16) +#define XTIMER_HZ (250000UL) +#define XTIMER_BACKOFF (40) +/** @} */ + +/** + * @brief Initialize board specific hardware, including clock, LEDs and stdio + */ +void board_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/microduino-corerf/include/periph_conf.h b/boards/microduino-corerf/include/periph_conf.h new file mode 100644 index 0000000000..3891b44078 --- /dev/null +++ b/boards/microduino-corerf/include/periph_conf.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2019 Benjamin Valentin + * + * 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. + */ + +/** + * @ingroup boards_microduino-corerf + * @{ + * + * @file + * @brief Peripheral MCU configuration for the Microduino CoreRF board + * + * @author Benjamin Valentin + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include "periph_conf_atmega_common.h" + +#ifdef __cplusplus +extern "C" { +} +#endif + +#endif /* PERIPH_CONF_H */ +/** @} */