ev11l78a: initial import of the UPD301C Basic Sink board.

This board is a relatively inexpensive development kit for USB-PD
controllers, using an UPD301C controller.

This Zephyr config includes support for:

 * UART (present on he debug header of the board), tested with the
   hello_world sample application;
 * the one standalone LED (CAP_MIS), tested with the blinky sample
   application;
 * the rotary encoder (PDO_SEL), via ADC, tested with the adc sample
   application;
 * the current sense amplifier (I_SENSE), currently untested;
 * the SPI bus, connected internally in the UPD301C to the UPD350;
 * the I2C bus, exposed on the debug header, currently untested.

Note that the drivers.uart.async_api.rtt has to be disabled, as it is
for other m0 boards with no dma or it fails to build.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
This commit is contained in:
Diego Elio Pettenò 2023-08-04 00:11:28 +01:00 committed by Fabio Baltieri
parent 79796d5c74
commit 762a1f8b42
14 changed files with 352 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# Microchip EV11L78A Board configuration
# Copyright (c) 2023 Meta Platforms, Inc. and its affiliates.
# SPDX-License-Identifier: Apache-2.0
config BOARD_EV11L78A
bool "Microchip EV11L78A"
depends on SOC_PART_NUMBER_SAMD20E16

View file

@ -0,0 +1,8 @@
# Microchip EV11L78A Board configuration
# Copyright (c) 2023 Meta Platforms, Inc. and its affiliates.
# SPDX-License-Identifier: Apache-2.0
config BOARD
default "ev11l78a"
depends on BOARD_EV11L78A

View file

@ -0,0 +1,4 @@
# Copyright (c) 2018 Sean Nyekjaer
# SPDX-License-Identifier: Apache-2.0
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View file

@ -0,0 +1,92 @@
.. _ev11l78a:
UPD301C Basic Sink Application Example
######################################
Overview
********
The UPD301C Basic Sink Application Example Evaluation Kit (EV11L78A)
is a low-cost evaluation platform for Microchip's UPD301C Standalone
Programmable USB Power Delivery (PD) Controller. This RoHS-compliant
evaluation platform comes in a small form factor and adheres to the
USB Type-C™ Connector Specification and USB PD 3.0 specification.
.. figure:: img/ev11l78a.jpg
:width: 500px
:align: center
:alt: EV11L78A
UPD301C Basic Sink Application Example (Credit: `Microchip Technology`_)
Hardware
********
- ATSAMD20E16 ARM Cortex-M0+ processor at 48 MHz
- UPD301C combines a SAMD20 core and a UPD350 USB-PD controller
- Sink PDO Selector Switch
- Onboard LED Voltmeter
Supported Features
==================
The ev11l78a board configuration supports the following hardware
features:
+-----------+------------+------------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+==========================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+------------------------------------------+
| Flash | on-chip | Can be used with LittleFS to store files |
+-----------+------------+------------------------------------------+
| SYSTICK | on-chip | systick |
+-----------+------------+------------------------------------------+
| WDT | on-chip | Watchdog |
+-----------+------------+------------------------------------------+
| GPIO | on-chip | I/O ports |
+-----------+------------+------------------------------------------+
| USART | on-chip | Serial ports |
+-----------+------------+------------------------------------------+
| SPI | on-chip | Serial Peripheral Interface ports |
+-----------+------------+------------------------------------------+
| I2C | on-chip | I²C ports |
+-----------+------------+------------------------------------------+
| ADC | on-chip | Analog-to-Digital Converter |
+-----------+------------+------------------------------------------+
Other hardware features are not currently supported by Zephyr.
Refer to the `EV11L78A Schematics`_ for a detailed hardware diagram.
The default configuration can be found in the Kconfig
:zephyr_file:`boards/arm/ev11l78a/ev11l78a_defconfig`.
Serial Port
===========
The SAMD20 MCU has 6 SERCOM based USARTs. One of the USARTs
(SERCOM1) is available on the Debug/Status header.
SPI Port
========
The SAMD20 MCU has 6 SERCOM based SPIs. One of the SPIs (SERCOM0)
is internally connected between the SAMD20 core and the UPD350.
I²C Port
========
The SAMD20 MCU has 6 SERCOM based I2Cs. One of the I2Cs (SERCOM3)
is available on the Debug/Status header.
References
**********
.. target-notes::
.. _Microchip Technology:
https://www.microchip.com/en-us/development-tool/ev11l78a
.. _EV11L78A Schematics:
https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/SupportingCollateral/03-00056-R1.0.PDF

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023, Meta Platforms, Inc. and its affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/samd20eXab-pinctrl.h>
&pinctrl {
sercom0_spi_default: sercom0_spi_default {
group1 {
pinmux = <PA8C_SERCOM0_PAD0>,
<PA9C_SERCOM0_PAD1>,
<PA11C_SERCOM0_PAD3>;
};
};
sercom1_uart_default: sercom1_uart_default {
group1 {
pinmux = <PA18C_SERCOM1_PAD2>,
<PA19C_SERCOM1_PAD3>;
};
};
sercom3_i2c_default: sercom3_i2c_default {
group1 {
pinmux = <PA17D_SERCOM3_PAD1>,
<PA18D_SERCOM3_PAD2>;
};
};
adc_default: adc_default {
group1 {
pinmux = <PA4B_ADC_AIN4>,
<PA5B_ADC_AIN5>;
};
};
};

View file

@ -0,0 +1,122 @@
/*
* Copyright (c) 2023, Meta Platforms, Inc. and its affiliates.
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <freq.h>
#include <atmel/samd20.dtsi>
#include "ev11l78a-pinctrl.dtsi"
/ {
model = "Microchip EV11L78A";
compatible = "atmel,samd20e16", "atmel,samd20";
aliases {
led0 = &cap_mis_led;
spi0 = &sercom0;
i2c0 = &sercom3;
};
chosen {
zephyr,console = &sercom1;
zephyr,shell-uart = &sercom1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
cap_mis_led: led_0 {
gpios = <&porta 23 GPIO_ACTIVE_HIGH>;
label = "CAP_MIS";
};
};
csa_i_sense: i_sense {
compatible = "current-sense-amplifier";
io-channels = <&adc 5>;
sense-resistor-micro-ohms = <4000>;
sense-gain-mult = <100>;
};
};
&cpu0 {
clock-frequency = <DT_FREQ_M(48)>;
};
&sercom0 {
status = "okay";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <2>;
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&porta 10 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&sercom0_spi_default>;
pinctrl-names = "default";
};
&sercom1 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
rxpo = <3>;
txpo = <1>;
pinctrl-0 = <&sercom1_uart_default>;
pinctrl-names = "default";
};
&sercom3 {
status = "okay";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&sercom3_i2c_default>;
pinctrl-names = "default";
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/*
* The final 16 KiB is reserved for the application.
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@3c000 {
label = "storage";
reg = <0x0003c000 0x00004000>;
};
};
};
&adc {
status = "okay";
prescaler = <32>;
#address-cells = <1>;
#size-cells = <0>;
channel@4 {
reg = <4>;
zephyr,gain = "ADC_GAIN_1_2";
zephyr,reference = "ADC_REF_VDD_1_2";
zephyr,vref-mv = <1650>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <4>;
};
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
};

View file

@ -0,0 +1,16 @@
identifier: ev11l78a
name: UPD301C Basic Sink Application Example
type: mcu
arch: arm
ram: 32
flash: 64
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- gpio
- i2c
- spi
- uart

View file

@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_SAMD20=y
CONFIG_SOC_PART_NUMBER_SAMD20E16=y
CONFIG_SOC_ATMEL_SAMD_OSC8M=y
CONFIG_SOC_ATMEL_SAMD_OSC8M_AS_MAIN=y
CONFIG_BOARD_EV11L78A=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y

View file

@ -0,0 +1,7 @@
# Copyright (c) 2021 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
# - /soc/pinmux@41004400 & /soc/gpio@41004400
# - /soc/pinmux@41004480 & /soc/gpio@41004480
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")

View file

@ -0,0 +1,22 @@
source [find interface/jlink.cfg]
transport select swd
# chip name
set CHIPNAME at91samd20e16
set ENDIAN little
set CPUTAPID 0x0bc11477
source [find target/at91samdXX.cfg]
reset_config trst_and_srst separate
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}

View file

@ -0,0 +1,11 @@
/*
* Copyright (c) 2023, Meta Platforms, Inc. and its affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
/ {
zephyr,user {
/* pin 4 ADC(+) */
io-channels = <&adc 4>;
};
};

View file

@ -0,0 +1,11 @@
/*
* Copyright (c) 2023, Meta Platforms, Inc. and its affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
/ {
zephyr,user {
/* pin 4 ADC(+) */
io-channels = <&adc 4>;
};
};

View file

@ -20,6 +20,7 @@ common:
- wio_terminal
- xiao_esp32c3
- atsamd20_xpro
- ev11l78a
tags:
- drivers
- uart