Skip to content

Commit

Permalink
boards/olimexino-stm32: add support for olimexino-stm32 board
Browse files Browse the repository at this point in the history
  • Loading branch information
kmikaz51 committed Mar 11, 2020
1 parent ed31630 commit 54cafc5
Show file tree
Hide file tree
Showing 19 changed files with 573 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boards/olimexino-stm32/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
3 changes: 3 additions & 0 deletions boards/olimexino-stm32/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
13 changes: 13 additions & 0 deletions boards/olimexino-stm32/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CPU = stm32f1
CPU_MODEL = stm32f103rb

# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_can
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
9 changes: 9 additions & 0 deletions boards/olimexino-stm32/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# we use shared STM32 configuration snippets
INCLUDES += -I$(RIOTBASE)/boards/common/stm32/include

# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PROGRAMMER=stm32flash

# Setup of programmer and serial is shared between STM32 based boards
include $(RIOTMAKE)/boards/stm32.inc.mk
34 changes: 34 additions & 0 deletions boards/olimexino-stm32/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2020 Scallog
*
* 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_olimexino-stm32
* @{
*
* @file
* @brief Board specific implementations for the OLIMEXINO STM32 board
*
* @author Corentin Vigourt <cvigourt@scallog.com>
*/

#include "board.h"
#include "periph/gpio.h"

void board_init(void)
{
/* initialize the CPU */
cpu_init();

/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);

/* initialize the button */
gpio_init(BTN0_PIN, BTN0_MODE);
}
/** @} */
67 changes: 67 additions & 0 deletions boards/olimexino-stm32/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
@defgroup boards_olimexino-stm32 STM32 Olimexino-stm32
@ingroup boards
@brief Support for the Olimexino STM32 board

## Overview

The Olimexino-stm32 is a board from Olimexino family supporting a ARM Cortex-M3
STM32F103RB microcontroller with 20Kb of SRAM and 128Kb of ROM Flash.

## Hardware

![Olimexino STM32](https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/images/thumbs/310x230/OLIMEXINO-STM32-01.jpg)

### MCU
| MCU | STM32F103RB |
|:---------- |:----------------- |
| Family | ARM Cortex-M3 |
| Vendor | ST Microelectronics |
| RAM | 20Kb |
| Flash | 128Kb |
| Frequency | up to 72MHz |
| FPU | no |
| Timers | 7 (2x watchdog, 1 SysTick, 4x 16-bit) |
| ADCs | 1x 12-bit (16 channels) |
| UARTs | 3 |
| SPIs | 2 |
| I2Cs | 2 |
| RTC | 1 |
| USB | 1 |
| CAN | 1 |
| Vcc | 2.0V - 3.6V |
| Datasheet | [Datasheet](http://www.st.com/resource/en/datasheet/stm32f103rb.pdf) |
| Reference Manual | [Reference Manual](https://www.st.com/resource/en/reference_manual/cd00171190.pdf) |
| Programming Manual | [Programming Manual](https://www.st.com/resource/en/programming_manual/cd00228163.pdf) |
| Board Manual | [Board Manual](https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/resources/OLIMEXINO-STM32.pdf) |

## Implementation Status
| Device | ID | Supported | Comments |
|:------------- |:------------- |:------------- |:------------- |
| MCU | STM32F103RB | partly | Energy saving modes not fully utilized |
| Low-level driver | GPIO | yes | |
| | PWM | yes (4 pins available) | |
| | UART | 3 UARTs | USART2 via D0(RX)/D1(TX), USART1 on PA10(RX)/PA09(TX) and USART3 on PB11(RX)/PB10(TX) |
| | ADC | 6 ADCs | |
| | I2C | yes (I2C1 and I2C2) | |
| | SPI | yes (SPI1 and SPI2) | |
| | USB | no | |
| | Timer | 3 16 bit timers (TIM2, TIM3 and TIM4) | |

## Flashing the device
The Olimexino-stm32 needs to be flashed using stm32flash (repo [here](https://github.com/stm32duino/stm32flash)).
Once you have installed the program, you can flash the board like this:

```
make BOARD=olimexino-stm32 flash
```
and open a terminal using:
```
make BOARD=olimexino-stm32 term
```

USART1 is used for flashing the board whereas USART2 is the serial Output.

## Supported Toolchains
For using the OLIMEXINO STM32 board you need to use ```arm-none-eabi```.
*/
78 changes: 78 additions & 0 deletions boards/olimexino-stm32/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2020 Scallog
*
* 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_olimexino-stm32
* @{
*
* @file
* @brief Board specific definitions for the OLIMEXINO STM32 board
*
* @author Corentin Vigourt <cvigourt@scallog.com>
*/

#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph_conf.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (19)
/** @} */

/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PORT GPIOA
#define LED0_PIN GPIO_PIN(PORT_A, 1)
#define LED0_MASK (1 << 1)

#define LED1_PORT GPIOA
#define LED1_PIN GPIO_PIN(PORT_A, 5)
#define LED1_MASK (1 << 5)

#define LED0_ON (LED0_PORT->BSRR = LED0_MASK)
#define LED0_OFF (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)

#define LED1_ON (LED1_PORT->BSRR = LED1_MASK)
#define LED1_OFF (LED1_PORT->BSRR = (LED1_MASK << 16))
#define LED1_TOGGLE (LED1_PORT->ODR ^= LED1_MASK)

#define LED_PANIC LED0_ON
/** @} */

/**
* @name User button
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_C, 9)
#define BTN0_MODE GPIO_IN
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H */
/** @} */
56 changes: 56 additions & 0 deletions boards/olimexino-stm32/include/gpio_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2020 Scallog
*
* 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_olimexino-stm32
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Corentin Vigourt <cvigourt@scallog.com>
*/

#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H

#include "board.h"
#include "saul/periph.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED2",
.pin = LED0_PIN,
.mode = GPIO_OUT
},
{
.name = "LED1",
.pin = LED1_PIN,
.mode = GPIO_OUT
},
{
.name = "BUT",
.pin = BTN0_PIN,
.mode = BTN0_MODE
},
};

#ifdef __cplusplus
}
#endif

#endif /* GPIO_PARAMS_H */
/** @} */
Loading

0 comments on commit 54cafc5

Please sign in to comment.