Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

boards: meshme CC2538 + CC2592 initial implementation #290

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions boards/m4a-24g/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,11 @@

#include "cpu.h"
#include "periph_conf.h"
#include "periph_cpu.h"
#include "periph/cpuid.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Get the CPU unique ID of this platform
* This function gets base cpu address using cpuid_get
*
* @param id pointer to char array with CPUID_LEN size.
*
*/
#define CPUID(id) cpuid_get(id);

/**
* @name xtimer configuration
* @{
Expand Down
11 changes: 0 additions & 11 deletions boards/m4a-mb/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,12 @@

#include "cpu.h"
#include "periph_conf.h"
#include "periph_cpu.h"
#include "periph/cpuid.h"

#ifdef __cplusplus
extern "C"
{
#endif

/**
* @brief Get the CPU unique ID of this platform
* This function gets base cpu address using cpuid_get
*
* @param id pointer to char array with CPUID_LEN size.
*
*/
#define CPUID(id) cpuid_get(id);

/**
* @name xTimer configuration
* @{
Expand Down
21 changes: 21 additions & 0 deletions boards/meshme/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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 "meshme" if BOARD_MESHME

config BOARD_MESHME
bool
default y
select CPU_MODEL_CC2538SF53
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_RTT
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
# Others
select HAS_RIOTBOOT
3 changes: 3 additions & 0 deletions boards/meshme/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
8 changes: 8 additions & 0 deletions boards/meshme/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ifneq (,$(filter netdev_default,$(USEMODULE)))
USEMODULE += cc2538_rf
USEMODULE += cc2538_rf_obs_sig
endif

ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
13 changes: 13 additions & 0 deletions boards/meshme/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CPU = cc2538
CPU_MODEL = cc2538sf53

# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

# Put other features for this board (in alphabetical order)
FEATURES_PROVIDED += riotboot
10 changes: 10 additions & 0 deletions boards/meshme/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# setup the default port depending on the host OS
PORT_LINUX ?= $(firstword $(sort $(wildcard /dev/ttyUSB*)))
# for MacOS
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))

PROGRAMMER ?= cc2538-bsl
CC2538_BSL_FLAGS_OPTS ?= --bootloader-invert-lines
CC2538_BSL_FLASHFILE ?= $(HEXFILE)

include $(RIOTBOARD)/common/cc2538/Makefile.include
55 changes: 55 additions & 0 deletions boards/meshme/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2022 Mesh4all <mesh4all.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file
* @brief Board specific implementations for the MeshMe board
* @copyright Copyright (c) 2022 Mesh for All (Mesh4all)
*/
#include "board.h"
#include "cpu.h"
#include "periph/gpio.h"

void board_init(void) {

// initialize the on-board LED 0
gpio_init(LED0_PIN, GPIO_OUT);

// initialize the on-board LED 1
gpio_init(LED1_PIN, GPIO_OUT);

// initialize the on-board LED 2
gpio_init(LED2_PIN, GPIO_OUT);

// initialize the on-board LED 3
gpio_init(LED3_PIN, GPIO_OUT);

// initialize the on-board user-button SW0
gpio_init(BTN0_PIN, BTN0_MODE);

// initialize the on-board user-button SW0
gpio_init(BTN1_PIN, BTN1_MODE);

if (IS_USED(MODULE_CC2538_RF)) {
gpio_init(HGM_PIN, GPIO_OUT);
HGM_ON;
}
// Compilation error <https://github.com/RIOT-OS/RIOT/pull/16055>
// workaround for lower RIOT versions, <https://github.com/Mesh4all/m4a-firmware/issues/43>
#if RIOT_VERSION_CODE < RIOT_VERSION_NUM(2021, 10, 0, 0)
cpu_init();
#endif
}
55 changes: 55 additions & 0 deletions boards/meshme/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
@defgroup boards_meshme MeshMe CC2538 +20dBm PA
@ingroup boards
@brief Mesh4All 2.4 GHz board + 20dBm PA

# Overview
MeshMe is a complete communications system based on TI's CC2538 system on chip (SoC) and
the CC2592 front end, featuring an ARM Cortex-M3 with 512KiB flash, 32KiB RAM and 2.4 GHz RF interface.

## Hardware

### Brain and RF, CC2538SF53

The CC2538 SoC combines an ARM Cortex-M3 microcontroller with an IEEE802.15.4 radio
plus a bunch of peripherals as you can see in the following table.

| MCU | CC2538SF53 |
|:----------------- |:------------------------- |
| Family | ARM Cortex-M3 |
| Vendor | Texas Instruments |
| RAM | 32KiB |
| Flash | 512KiB |
| Frequency | 32MHz |
| FPU | no |
| Timers | 4 |
| ADCs | 1x 12-bit (8 channels) |
| UARTs | 2 |
| SPIs | 2 |
| I2Cs | 1 |
| Vcc | 2V - 3.6V |
| Datasheet | [Datasheet](http://www.ti.com/lit/gpn/cc2538) (pdf file) |
| Reference Manual | [Reference Manual](http://www.ti.com/lit/pdf/swru319) |

### Power Amplifier, CC2592

The TI's CC2592 is front end (FE) designed for the CC25XX family, it contains PA, LNA, switches, RF-matching, and balun.

| CC2592 | Min | Max |
|:------------------|:--------:|:---------:|
| Vcc | 2V | 3.7V |
| Frequency range | 2400MHz | 2483.5MHz |
| Output power (PA) | | 22 dBm |
| LNA Gain | 6 dB | 11 dB |
| Datasheet | [Datasheet](https://www.ti.com/lit/ds/symlink/cc2592.pdf) (pdf file) |

The device is controlled by three digital terminals, PA_EN, LNA_EN, and HGM.
The control logic is shown in the following table:

| PA_EN | LNA_EN | HGM | Mode of operation |
|:-----:|:------:|:---:|:------------------|
| 0 | 0 | X | Power down |
| X | 1 | 0 | Rx mode Low Gain |
| X | 1 | 1 | Rx mode High Gain |
| 1 | 0 | X | Tx mode |
*/
128 changes: 128 additions & 0 deletions boards/meshme/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright (C) 2014 Loci Controls Inc.
* Copyright (C) 2022 Mesh4all <contact@mesh4all.org>
*
* 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_meshme
* @{
*
* @file
* @brief Board specific definitions for the MeshMe 24G20P
*
* @author Ian Martin <ian@locicontrols.com>
* @author Luis A. Ruiz <luisan00@hotmail.com>
*/
#ifndef BOARD_H
#define BOARD_H

#include "cpu.h"
#include "periph/gpio.h"
#include "cc2538_eui_primary.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_C, 5) /*!< LED-0 (?) routed to PC5 pin */
#define LED0_ON gpio_set(LED0_PIN) /*!< LED-0 On handler */
#define LED0_OFF gpio_clear(LED0_PIN) /*!< LED-0 Off handler */
#define LED0_TOGGLE gpio_toggle(LED0_PIN) /*!< LED-0 Toggle handler */

#define LED1_PIN GPIO_PIN(PORT_C, 4) /*!< LED-1 (green) routed to PC4 pin */
#define LED1_ON gpio_set(LED1_PIN) /*!< LED-1 On handler */
#define LED1_OFF gpio_clear(LED1_PIN) /*!< LED-1 Off handler */
#define LED1_TOGGLE gpio_toggle(LED1_PIN) /*!< LED-1 Toggle handler */

#define LED2_PIN GPIO_PIN(PORT_C, 1) /*!< LED 2 (orange) routed to PC1 pin */
#define LED2_ON gpio_set(LED2_PIN) /*!< LED2 On handler */
#define LED2_OFF gpio_clear(LED2_PIN) /*!< LED2 Off handler */
#define LED2_TOGGLE gpio_toggle(LED2_PIN) /*!< LED2 Toggle handler */

#define LED3_PIN GPIO_PIN(PORT_C, 0) /*!< LED 3 (red) routed to PC0 pin */
#define LED3_ON gpio_set(LED3_PIN) /*!< LED3 On handler */
#define LED3_OFF gpio_clear(LED3_PIN) /*!< LED3 Off handler */
#define LED3_TOGGLE gpio_toggle(LED3_PIN) /*!< LED3 Toggle handler */
/** @} */

/**
* @name User button SW0 pin definition, labeled K1 on the board
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_C, 7) /*!< It's routed to PC7 pin */
#define BTN0_MODE GPIO_IN_PU /*!< Pin mode */
/** @} */

/**
* @name User button SW1 pin definition, labeled K2 on the board
* @{
*/
#define BTN1_PIN GPIO_PIN(PORT_C, 6) /*!< It's routed to PC6 pin */
#define BTN1_MODE GPIO_IN_PU /*!< Pin mode */
/** @} */

/**
* @name Flash Customer Configuration Area (CCA) parameters
* @{
*/
#ifndef UPDATE_CCA
#define UPDATE_CCA 1 /*!< On/Off Customer Configuration Area should be updated */
#endif

#define CCA_BACKDOOR_ENABLE 1 /*!< On/Off the backdoor on boot */
#define CCA_BACKDOOR_PORT_A_PIN 3 /*!< Boot button is PORT_A, 3 (PA3) */
#define CCA_BACKDOOR_ACTIVE_LEVEL 0 /*!< Active when signal is low: 0 */
/** @} */

/**
* @name xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16) /*!< ToDo */
#define XTIMER_BACKOFF (50) /*!< ToDo */
#define XTIMER_ISR_BACKOFF (40) /*!< ToDo */
/** @} */

/**
* @name RF Front-End configuration
*
* @brief The FE CC2592 is controlled by the CC2538 with 3 pins, both are connected as follow:
*
* | CC2538 (MCU) | CC2592 (FE) | Description |
* |--------------|-------------|----------------------------------------|
* | PORT_D, 2 | HGM_EN | High Gain Mode (enabled/disabled) |
* | PORT_C, 2 | LNA_EN | Low Noise Amplifier (enabled/disabled) |
* | PORT_C, 3 | PA_EN | Power Amplifier (enabled/disabled) |
*
* The CC2538 RF Core needs to use "observable signals" to drive the LNA_EN and the PA_EN pins
* @{
*/
#define CONFIG_CC2538_RF_OBS_SIG_0_PCX 3 /*!< tx active to PC3, it controls the PA */
#define CONFIG_CC2538_RF_OBS_SIG_1_PCX 2 /*!< rx active to PC2, it controls the LNA */
#define CONFIG_CC2538_RF_OBS_SIG_2_PCX 0 /*!< rssi valid, routed to the on board red LED PC0 */

#define HGM_PIN GPIO_PIN(PORT_D, 2) /*!< High Gain Mode (HGM) pin */
#define HGM_ON gpio_set(HGM_PIN) /*!< HGM on handler */
#define HGM_OFF gpio_clear(HGM_PIN) /*!< HGM off handler */
#define HGM_TOGGLE gpio_toggle(HGM_PIN) /*!< HGM toggle handler */
/** @} */

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

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H */
/** @} */
Loading