Skip to content

Commit

Permalink
Merge pull request #21111 from benpicco/cpu/same51
Browse files Browse the repository at this point in the history
boards/same51-curiosity-nano: add support for the board
  • Loading branch information
benpicco authored Jan 8, 2025
2 parents 758a92f + bb49638 commit f8b41eb
Show file tree
Hide file tree
Showing 126 changed files with 57,601 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boards/same51-curiosity-nano/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/same51-curiosity-nano/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
19 changes: 19 additions & 0 deletions boards/same51-curiosity-nano/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CPU = samd5x
CPU_MODEL = same51j20a

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

# Put other features for this board (in alphabetical order)
FEATURES_PROVIDED += riotboot
FEATURES_PROVIDED += tinyusb_device
8 changes: 8 additions & 0 deletions boards/same51-curiosity-nano/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# If port selection via ttys.py is enabled by `MOST_RECENT_PORT=1`, filter
# USB serials to only select the UART bridge of the embedded EDBG CMSIS-DAP
# debugger.
TTY_BOARD_FILTER := --model 'nEDBG CMSIS-DAP'

PROGRAMMER ?= openocd

include $(RIOTMAKE)/boards/sam0.inc.mk
2 changes: 2 additions & 0 deletions boards/same51-curiosity-nano/dist/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source [find target/atsame5x.cfg]
$_TARGETNAME configure -rtos auto
86 changes: 86 additions & 0 deletions boards/same51-curiosity-nano/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
@defgroup boards_same51-curiosity-nano Microchip SAM E51 Curiosity Nano
@ingroup boards
@brief Support for the Microchip SAM E51 Curiosity Nano board.

## Overview

The `SAM E51 Curiosity Nano` is an evaluation board by Microchip featuring an
ATSAME51J20A SoC. The SoC includes a SAM E51 ARM Cortex-M4F microcontroller.
For programming the MCU comes with 256Kb of RAM and 1024Kb of flash memory.

The `same51-curiosity-nano` is available from various hardware vendors for ~15$
(as of 2024 December).

## Hardware

![same51-curiosity-nano image](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3368-200511-mcu32-ev76s68a-sam-e51-curiosity-nano.jpg)


### MCU
| MCU | ATSAME51J20A |
|:------------ |:--------------------- |
| Family | ARM Cortex-M4F |
| Vendor | Microchip |
| RAM | 256Kb |
| Flash | 1024Kb |
| Frequency | up to 120MHz |
| FPU | yes |
| Timers | 8 (16-bit) |
| ADCs | 2x 12-bit (20 channels) |
| UARTs | max 6 (shared with SPI and I2C) |
| SPIs | max 6 (see UART) |
| I2Cs | max 6 (see UART) |
| Vcc | 1.62V - 3.63V |
| Datasheet | [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/60001507C.pdf) |
| Board Manual | [Board Manual](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU32/ProductDocuments/UserGuides/SAM-E51-Curiosity-Nano-User-Guide-DS70005432.pdf)|

### User Interface

1 User button and 1 LED:

| Device | PIN |
|:------------ |:---- |
| LED0 | PA14 |
| SW0 (button) | PA15 |


## Implementation Status

| Device | ID | Supported | Comments |
|:---------------- |:--------- |:--------- |:--------- |
| MCU | same51 | yes | |
| Low-level driver | GPIO | yes | |
| | ADC | yes | |
| | CAN | yes | |
| | DAC | yes | |
| | PWM | yes | |
| | UART | yes | |
| | I2C | yes | |
| | SPI | yes | |
| | USB | yes | |
| | RTT | yes | |
| | RTC | yes | |
| | RNG | yes | |
| | Timer | yes | |


## Flashing the device

Connect the device to your Micro-USB cable using the port labeled as
*DEBUG USB*.

The standard method for flashing RIOT to the board is using OpenOCD.
by calling: `make BOARD=same51-curiosity-nano -C tests/leds flash`

On Linux you will have to add a **udev** rule for hidraw, like
```
bash
echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"' \
| sudo tee -a /etc/udev/rules.d/99-usb.rules
sudo service udev restart
```

## Known Issues / Problems

*/
57 changes: 57 additions & 0 deletions boards/same51-curiosity-nano/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2024 ML!PA Consulting GmbH
*
* 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_same51-curiosity-nano
* @{
*
* @file
* @brief Board specific definitions for the Microchip SAM E51 Curiosity Nano
* board
*
* @author Benjamin Valentin <[email protected]>
*/

#ifndef BOARD_H
#define BOARD_H

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

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PA, 14)

#define LED_PORT PORT->Group[PA]
#define LED0_MASK (1 << 14)

#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
/** @} */

/**
* @name SW0 (Button) pin definitions
* @{
*/
#define BTN0_PIN GPIO_PIN(PA, 15)
#define BTN0_MODE GPIO_IN_PU
/** @} */

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H */
/** @} */
53 changes: 53 additions & 0 deletions boards/same51-curiosity-nano/include/gpio_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (C) 2024 ML!PA Consulting GmbH
*
* 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_same51-curiosity-nano
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Benjamin Valentin <[email protected]>
*/

#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 = "LED(orange)",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INVERTED
},
{
.name = "Button(SW0)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
};

#ifdef __cplusplus
}
#endif

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

0 comments on commit f8b41eb

Please sign in to comment.