Skip to content

Commit

Permalink
Merge #19695 #19706
Browse files Browse the repository at this point in the history
19695: drivers/hih6130: avoid using floats r=maribu a=maribu

### Contribution description

- avoid using floating point arithmetic
- use ztimer instead of xtimer
- use fmt to print fixed point numbers in the test app


19706: boards/olimex-msp430-h2618: add new board r=maribu a=maribu

### Contribution description

This adds support of the Olimex MSP430-H2618 board. This board has plenty of RAM and ROM for an MSP430 board (even more than the z1), but still is easily obtainable.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
  • Loading branch information
3 people authored Jun 8, 2023
3 parents 72914bb + bb366c4 + 1f4934c commit 350a0bf
Show file tree
Hide file tree
Showing 34 changed files with 3,407 additions and 876 deletions.
5 changes: 0 additions & 5 deletions boards/common/msb-430/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
extern "C" {
#endif

/**
* @brief Address of the info memory
*/
#define INFOMEM (0x1000)

/**
* @name Xtimer configuration
* @{
Expand Down
22 changes: 0 additions & 22 deletions boards/olimex-msp430-h1611/include/board-conf.h

This file was deleted.

18 changes: 18 additions & 0 deletions boards/olimex-msp430-h2618/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020 HAW Hamburg
#
# 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.

config BOARD
default "olimex-msp430-h2618" if BOARD_OLIMEX_MSP430_H2618

config BOARD_OLIMEX_MSP430_H2618
bool
default y
select CPU_MODEL_MSP430F2618
select HAS_PERIPH_GPIO
select HAS_PERIPH_GPIO_IRQ
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
3 changes: 3 additions & 0 deletions boards/olimex-msp430-h2618/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
10 changes: 10 additions & 0 deletions boards/olimex-msp430-h2618/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CPU = msp430fxyz
CPU_MODEL = msp430f2618

# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

# Various other features (if any)
26 changes: 26 additions & 0 deletions boards/olimex-msp430-h2618/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial-MXV*)))

# flash tool configuration
PROGRAMMER ?= mspdebug
MSPDEBUG_PROGRAMMER ?= olimex

PROGRAMMERS_SUPPORTED += mspdebug

# When freshly plugged in the Olimex MSP430-JTAG-Tiny debugger provides a
# ttyACM interface, which is only available until the first flashing. A
# `make term` or even a `make flash term` may pick the JTAG debugger instead
# of the correct USB TTL adapter when the JTAG programmer is plugged in after
# the TTL adapter and `MOST_RECENT_PORT=1` is used.
#
# To fix that, we filter first by the most common USB TTL adapter drivers and
# fall back to all TTY when no such TTL adapter is found.
TTY_BOARD_FILTER := --driver 'cp210x|ch341|ftdi_sio'
TTY_SELECT_CMD := $(RIOTTOOLS)/usb-serial/ttys.py \
--most-recent \
--format path serial \
$(TTY_BOARD_FILTER) || \
$(RIOTTOOLS)/usb-serial/ttys.py \
--most-recent \
--format path serial
111 changes: 111 additions & 0 deletions boards/olimex-msp430-h2618/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
@defgroup boards_olimex_msp430_h2618 Olimex MSP430-H2618
@ingroup boards
@brief Support for the Olimex MSP430-H2618 board

<img src="https://github.com/maribu/images/raw/master/Olimex%20MSP430-H2618.jpeg" alt="Photo of Olimex MSP430-H2618 Board" style="width: 512px; max-width: 100%;">

## MCU

| MCU | TI MSP430F2618 |
|:----------------- |:------------------------------------------------------------- |
| Family | MSP430 |
| Vendor | Texas Instruments |
| Package | 64 QFN |
| RAM | 8 KiB |
| Flash | 116 KiB |
| Frequency | 16 MHz |
| FPU | no |
| Timers | 2 (2x 16bit) |
| ADCs | 1x 8 channel 12-bit |
| UARTs | 2 |
| SPIs | 2 |
| I2Cs | 1 |
| Vcc | 1.8 V - 3.6 V |
| Datasheet MCU | [Datasheet MSP430F2618] |
| User Guide MCU | [User Guide MSP430F2xx] |
| Datasheet Board | [Datasheet Olimex MSP430-H2618] |
| Website | [Website Olimex MSP430-H2618] |

[Datasheet MSP430F2618]: https://www.ti.com/lit/gpn/msp430f2618
[User Guide MSP430F2xx]: https://www.ti.com/lit/pdf/slau144
[Datasheet Olimex MSP430-H2618]: https://www.olimex.com/Products/MSP430/Header/MSP430-H2618/resources/MSP430-H2618.pdf
[Website Olimex MSP430-H2618]: https://www.olimex.com/Products/MSP430/Header/MSP430-H2618/

@warning While erasing or writing to the flash, the MCU must be powered by
at least 2.2 V

## Schematics

<img src="https://raw.githubusercontent.com/maribu/images/master/Olimex%20MSP430-H2618%20Schematic.svg" alt="Schematics of the Olimex MSP430-H2618 Board" style="width: 800px; max-width: 100%;">

## Pinout

The 64 pins on the edges of the PCB are connected to the corresponding MCU pins.
Hence, the following pinout of the naked MSP430-F2618 MCU chip matches the
pinout of the header board:

<img src="https://github.com/maribu/images/raw/master/MSP430F2618%20Pinout.svg" alt="Pinout of the naked MSP430-F2618 MCU" style="width: 800px; max-width: 100%;">

## Flashing RIOT

<img src="https://github.com/maribu/images/raw/master/Olimex%20MSP430-H2618%20with%20Debugger.jpeg" alt="Photo of Olimex MSP430-H2618 Board connected to a JTAG Debugger" style="width: 512px; max-width: 100%;">

Connect the board to a JTAG debugger supported by
[mspdebug](https://dlbeer.co.nz/mspdebug/); by default the
Olimex MSP430-JTAG-Tiny (as shown in the picture above) is assumed, which is
among the less expensive options.

@note If you are not using the Olimex MSP430-JTAG-Tiny (or a compatible
programmer), set `MSPDEBUG_PROGRAMMER` to the correct value via
an environment variable or as parameter to make. E.g. use
`make BOARD=olimex-msp430-h2618 MSPDEBUG_PROGRAMMER=bus-pirate` to
flash using the bus pirate.

@warning You can power the board via the JTAG programmer by placing a
jumper at `P_IN`. However, the JTAG programmer will only be able
to provide a limited current. You may want to disconnect the
header board from devices consuming a lot of power prior to
flashing.

@warning If the board is powered externally, make sure to place the jumper
in `P_OUT` position, not in `P_IN` position.

@warning A jumper in `P_OUT` is mutually exclusive to a jumper in `P_IN`.
Never connect both at the same time.

@note Pin 1 on the JTAG connector has a small white triangle next to it
and square pad, compared to the round pad used by all other JTAG
pins.

@warning The Olimex MSP430-JTAG-Tiny will fail to flash or debug the board
until the latest firmware is installed. For that, install the
Windows-only programmer software and update the DLLs files to
contain the latest firmware as described in the website. The
software will update the programmer upon launch.

Once the jumper is correctly placed in either `P_IN` or in `P_OUT` and the
JTAG cable is connected just run

```
make BOARD=olimex-msp430-h2618 flash
```

## Using the shell

stdio is available via the UART interface with `TXD = P3.4`
(pin 35 on the header) and `RXD = P3.5` (pin 34 on the header) at 115,200 Baud.

The easiest way is to connect an USB TTL adapter (such as the cheap `cp210x`
or `ch341` based adapters) as follows:

```
TTL adapter Olimex MSP430-H2618
----------- -------------------

GND --- 63 (DV_SS)
TXD --- 33 (P3.5)
RXD --- 32 (P3.4)
```

*/
50 changes: 50 additions & 0 deletions boards/olimex-msp430-h2618/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2013, 2014 INRIA
* 2015 Freie Universität Berlin
*
* 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_olimex_msp430_h2618
*
* @{
*
* @file
* @brief Basic definitions for the Olimex MSP430-H2618 board
*
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net>
*/

#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __MSP430F2618__
#define __MSP430F2618__
#endif

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

#ifdef __cplusplus
}
#endif

/** @} */
#endif /* BOARD_H */
99 changes: 99 additions & 0 deletions boards/olimex-msp430-h2618/include/periph_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (C) 2014 INRIA
* 2015 Freie Universität Berlin
*
* 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_olimex_msp430_h2618
* @{
*
* @file
* @brief Olimex-MSP430-H2618 peripheral configuration
*
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net>
*/

#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "macros/units.h"

#ifdef __cplusplus
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
.target_dco_frequency = MHZ(16),
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
.submain_clock_source = SUBMAIN_CLOCK_SOURCE_DCOCLK,
.main_clock_divier = MAIN_CLOCK_DIVIDE_BY_1,
.submain_clock_divier = SUBMAIN_CLOCK_DIVIDE_BY_1,
.auxiliary_clock_divier = AUXILIARY_CLOCK_DIVIDE_BY_1,
};

/**
* @name Timer configuration
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
/** @} */

/**
* @name UART configuration
* @{
*/
#define UART_NUMOF (1U)

#define UART_USE_USCI
#define UART_BASE (USCI_0)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_IE_RX_BIT (1 << 0)
#define UART_IE_TX_BIT (1 << 1)
#define UART_RX_PORT ((msp_port_t *)PORT_3)
#define UART_RX_PIN (1 << 5)
#define UART_TX_PORT ((msp_port_t *)PORT_3)
#define UART_TX_PIN (1 << 4)
#define UART_RX_ISR (USCIAB0RX_VECTOR)
#define UART_TX_ISR (USCIAB0TX_VECTOR)
/** @} */

/**
* @name SPI configuration
* @{
*/
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_USE_USCI
#define SPI_BASE (USCI_0_B_SPI)
#define SPI_IE (SFR->IE2)
#define SPI_IF (SFR->IFG2)
#define SPI_IE_RX_BIT (1 << 2)
#define SPI_IE_TX_BIT (1 << 3)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
#define SPI_PIN_MOSI GPIO_PIN(P3, 1)
#define SPI_PIN_CLK GPIO_PIN(P3, 3)
/** @} */

#ifdef __cplusplus
}
#endif

#endif /* PERIPH_CONF_H */
/** @} */
22 changes: 0 additions & 22 deletions boards/telosb/include/board-conf.h

This file was deleted.

Loading

0 comments on commit 350a0bf

Please sign in to comment.