1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/hip-badge: add HiP Badge board definition

This commit is contained in:
Benjamin Valentin 2022-12-28 18:13:16 +01:00 committed by Benjamin Valentin
parent 55b5c47bc8
commit 82d7368415
10 changed files with 359 additions and 0 deletions

21
boards/hip-badge/Kconfig Normal file
View File

@ -0,0 +1,21 @@
# Copyright (c) 2023 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.
config BOARD
default "hip-badge" if BOARD_HIP_BADGE
config BOARD_HIP_BADGE
bool
default y
select BOARD_COMMON_ESP32C3
select CPU_MODEL_ESP32C3
select HAS_ESP_JTAG
select HAS_PERIPH_I2C
select HAVE_SAUL_GPIO
select HAVE_SGP30
source "$(RIOTBOARD)/common/esp32c3/Kconfig"

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/esp32c3
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,9 @@
ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE)))
USEMODULE += stdio_usb_serial_jtag
endif
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += sgp30
endif
include $(RIOTBOARD)/common/esp32c3/Makefile.dep

View File

@ -0,0 +1,10 @@
CPU_MODEL = esp32c3
# common board and CPU features
include $(RIOTBOARD)/common/esp32c3/Makefile.features
# additional features provided by the board
FEATURES_PROVIDED += periph_i2c
# unique features provided by the board
FEATURES_PROVIDED += esp_jtag

View File

@ -0,0 +1,3 @@
PORT_LINUX ?= /dev/ttyACM0
include $(RIOTBOARD)/common/esp32c3/Makefile.include

62
boards/hip-badge/doc.txt Normal file
View File

@ -0,0 +1,62 @@
/*
* Copyright (C) 2023 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.
*/
/**
* @defgroup boards_hip_badge HiP Badge
* @ingroup boards_esp32c3
* @brief Support for the Hacking in Parallel Badge
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
The HiP Badge is a board that was given to participants of the 2022 *Hacking in Parallel* event.
![Image of the HiP badge with custom frame and SAO (I2C) expander](https://camo.githubusercontent.com/834dbee4ed9a9a90480bd1a239e54718f3a9613b694d0a2e26a3b25e55ce2d82/68747470733a2f2f6d61747269782d636c69656e742e6d61747269782e6f72672f5f6d61747269782f6d656469612f72302f646f776e6c6f61642f6d6f6e65726f2e736f6369616c2f757351777a4f656957516e6671546247416845734b684a76)
# Features
- ESP32-C3FH4AZ SoC
- I2C via SAO headers
- UART via pin headers
- 16 WS2812B LEDs
- USB-C Serial/JTAG
- 3 User button / 1 Reset button
- ST25DV04K NFC/I2C EEPROM (TODO: driver)
# Flashing the device
The device can be programmed using the USB-C Serial/JTAG feature.
Just plug in a cable to your computer and flash the device with
make BOARD=hip-badge flash
This should automatically reset the ESP32C3 into bootloader mode and start the download process.
If for some reason this gets stuck or the badge does not register as a /dev/ttyACMx device, you
can manually force it into bootloader mode by pressing the reset button (SW3/blue) while holding
the BOOT button (SW4).
When doing this, the device will still be in bootloader mode after flashing, you have to press
the reset button (SW3/blue) again to start your application.
There is currently still a bug in the USB Serial stdio implementation: After flashing or a reboot,
there is no output. Do a manual reset (press the reset button) to restore output.
# Bugs
The event (and badge) were organized on short notice (6 Weeks), so there are some hardware issues:
- No WiFi/BLE antenna. There is a pad on the back of the PCB where a socket was supposed to be, but
nothing is connected. You can try solder something onto it yourself, but the trace is already long
and winded.
BLE works with the existing trace alone (on short range), WiFi/ESP Now does not.
- IR transceiver broken. Can be fixed with a steady hand?
- SGP30 air quality sensor is only populated on some boards (red case)
- MAX17048 fuel gauge not populated
# Resources
- [Badge Clinic](https://wiki.hip-berlin.de/index.php?title=Badge_Clinic)
- [Design files](https://gitlab.com/tidklaas/hip-badge/)

View File

@ -0,0 +1 @@
CONFIG_MODULE_STDIO_USB_SERIAL_JTAG=y

View File

@ -0,0 +1,117 @@
/*
* Copyright (C) 2023 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_hip_badge
* @brief Board definitions for the HiP Badge
* @{
*
* @file
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
/**
* @name Button pin definitions
* @{
*/
/**
* @brief Tact A GPIO pin definition
*/
#define BTN0_PIN GPIO2
/**
* @brief button GPIO mode definition
*
* Since the GPIO of the button is pulled up with an external resistor, the
* mode for the GPIO pin has to be GPIO_IN.
*/
#define BTN0_MODE GPIO_IN
/**
* @brief Default interrupt flank definition for the button GPIO
*/
#ifndef BTN0_INT_FLANK
#define BTN0_INT_FLANK GPIO_FALLING
#endif
/**
* @brief Tact B GPIO pin definition
*/
#define BTN1_PIN GPIO8
/**
* @brief Default button GPIO mode definition
*
* Since the GPIO of the button is pulled up with an external resistor, the
* mode for the GPIO pin has to be GPIO_IN.
*/
#define BTN1_MODE GPIO_IN
/**
* @brief Default interrupt flank definition for the button GPIO
*/
#ifndef BTN1_INT_FLANK
#define BTN1_INT_FLANK GPIO_FALLING
#endif
/**
* @brief BOOT button GPIO pin definition
*
* The HiP-Badge has a BOOT button connected to GPIO9, which can be
* used as button during normal operation. Since the GPIO9 pin is pulled up,
* the button signal is inverted, i.e., pressing the button will give a
* low signal.
*/
#define BTN2_PIN GPIO9
/**
* @brief Default button GPIO mode definition
*/
#define BTN2_MODE GPIO_IN_PU
/**
* @brief Default interrupt flank definition for the button GPIO
*/
#ifndef BTN2_INT_FLANK
#define BTN2_INT_FLANK GPIO_FALLING
#endif
/** @} */
/**
* @brief WS281x LEDs are connected to GPIO10
*/
#ifndef WS281X_PARAM_PIN
#define WS281X_PARAM_PIN GPIO10
#endif
/**
* @brief There are 16 WS281x LEDs
*/
#ifndef WS281X_PARAM_NUMOF
#define WS281X_PARAM_NUMOF 16
#endif
/* include common board definitions as last step */
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2023 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_hip_badge
* @brief Board specific configuration of direct mapped GPIOs
* @file
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
* @{
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LED and Button configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "SW1",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
{
.name = "SW2",
.pin = BTN1_PIN,
.mode = BTN1_MODE,
.flags = SAUL_GPIO_INVERTED
},
{
.name = "Boot",
.pin = BTN2_PIN,
.mode = BTN2_MODE,
.flags = SAUL_GPIO_INVERTED
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,74 @@
/*
* Copyright (C) 2023 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_hip_badge
* @brief Peripheral configurations for the HiP Badge
* @{
*
* @file
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name I2C configuration
*
* One I2C interface I2C_DEV(0) is defined and available via the SAO headers.
*
* The GPIOs listed in the configuration are only initialized as I2C signals
* when module `periph_i2c` is used. Otherwise they are not allocated and
* can be used for other purposes.
*
* @{
*/
#ifndef I2C0_SPEED
#define I2C0_SPEED I2C_SPEED_FAST /**< I2C bus speed of I2C_DEV(0) */
#endif
#ifndef I2C0_SCL
#define I2C0_SCL GPIO6 /**< SCL signal of I2C_DEV(0) */
#endif
#ifndef I2C0_SDA
#define I2C0_SDA GPIO5 /**< SDA signal of I2C_DEV(0) */
#endif
/** @} */
/**
* @name UART configuration
*
* ESP32-C3 provides 2 UART interfaces at maximum:
*
* UART_DEV(0) uses fixed standard configuration.<br>
* UART_DEV(1) is used for IrDA (untested).<br>
*
* @{
*/
#define UART0_TXD GPIO21 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */
#define UART0_RXD GPIO20 /**< direct I/O pin for UART_DEV(0) RxD, can't be changed */
#define UART1_TXD GPIO7 /**< IrDA TX - Bad Choice? */
#define UART1_RXD GPIO3 /**< IrDA RX - Bad Choice? */
/** @} */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/* include common peripheral definitions as last step */
#include "periph_conf_common.h"
#endif /* PERIPH_CONF_H */
/** @} */