Skip to content

Add Basic support for Microchip SAM D5X/E5X Family devices #93450

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/Kconfig.sam_e54_xpro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

config BOARD_SAM_E54_XPRO
select SOC_ATSAME54P20A
4 changes: 4 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
9 changes: 9 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

board:
name: sam_e54_xpro
full_name: SAM E54 Xplained Pro
vendor: microchip
socs:
- name: atsame54p20a
Binary file not shown.
Binary file not shown.
160 changes: 160 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
.. zephyr:board:: sam_e54_xpro

SAM E54 Xplained Pro Evaluation Kit
###################################

Overview
********

The SAM E54 Xplained Pro evaluation kit is ideal for evaluation and
prototyping with the SAM E54 Cortex®-M4F processor-based
microcontrollers. The kit includes Microchip’s Embedded Debugger (EDBG),
which provides a full debug interface without the need for additional
hardware.

.. image:: img/atsam_e54_xpro.webp
:align: center
:alt: SAM_E54_XPRO

Hardware
********

- ATSAME54P20A ARM Cortex-M4F processor at 120 MHz
- 32.768 kHz crystal oscillator
- 12 MHz crystal oscillator
- 1024 KiB flash memory and 256 KiB of RAM
- One yellow user LED
- One mechanical user push button
- One reset button
- On-board USB based EDBG unit with serial console
- One QTouch® PTC button
- 32 MiB QSPI Flash
- ATECC508 CryptoAuthentication™ device
- AT24MAC402 serial EEPROM with EUI-48™ MAC address
- Ethernet

- RJ45 connector with built-in magnetics
- KSZ8091RNA PHY
- 10Base-T/100Base-TX IEE 802.3 compliant Ethernet transceiver

- USB interface, host, and device
- SD/SDIO card connector

Supported Features
==================

.. zephyr:board-supported-hw::

The default configuration can be found in the Kconfig
:zephyr_file:`boards/microchip/sam/sam_e54_xpro/sam_e54_xpro_defconfig`.

Pin Mapping
===========

The SAM E54 Xplained Pro evaluation kit has 4 GPIO controllers. These
controllers are responsible for pin muxing, input/output, pull-up, etc.

For more details please refer to `SAM D5x/E5x Family Datasheet`_ and the `SAM E54
Xplained Pro Schematic`_.

.. image:: img/atsam_e54_xpro_pinout.webp
:align: center
:alt: SAME54-XPRO-pinout

Default Zephyr Peripheral Mapping:
----------------------------------
- SERCOM2 USART TX : PB24
- SERCOM2 USART RX : PB25
- GPIO/PWM LED0 : PC18
- GPIO SW0 : PB31
- GMAC RMII REFCK : PA14
- GMAC RMII TXEN : PA17
- GMAC RMII TXD0 : PA18
- GMAC RMII TXD1 : PA19
- GMAC RMII CRSDV : PC20
- GMAC RMII RXD0 : PA13
- GMAC RMII RXD1 : PA12
- GMAC RMII RXER : PA15
- GMAC MDIO MDC : PC11
- GMAC MDIO MDIO : PC12
- SERCOM4 SPI SCK : PB26
- SERCOM4 SPI MOSI : PB27
- SERCOM4 SPI MISO : PB29
- SERCOM7 I2C SDA : PD08
- SERCOM7 I2C SCL : PD09
- USB DP : PA25
- USB DM : PA24

System Clock
============

The SAME54 MCU is configured to use the 32.768 kHz external oscillator
with the on-chip PLL generating the 48 MHz system clock.

Serial Port
===========

The SAME54 MCU has 8 SERCOM based USARTs with one configured as USARTs in
this BSP. SERCOM2 is the default Zephyr console.

- SERCOM2 115200 8n1 connected to the onboard Microchip Embedded Debugger (EDBG)

Programming and Debugging
*************************

The SAM E54 Xplained Pro comes with a Microchip Embedded Debugger (EDBG). This
provides a debug interface to the SAME54 chip and is supported by
OpenOCD.

Flashing
========

#. Build the Zephyr kernel and the ``hello_world`` sample application:

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: sam_e54_xpro
:goals: build
:compact:

#. Connect the SAM E54 Xplained Pro to your host computer using the USB debug
port.

#. Run your favorite terminal program to listen for output. Under Linux the
terminal should be :code:`/dev/ttyACM0`. For example:

.. code-block:: console

$ minicom -D /dev/ttyACM0 -o

The -o option tells minicom not to send the modem initialization
string. Connection should be configured as follows:

- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1

#. To flash an image:

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: sam_e54_xpro
:goals: flash
:compact:

You should see "Hello World! same_54_xpro" in your terminal.

References
**********

.. target-notes::

.. _Microchip website:
http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=ATSAME54-XPRO

.. _SAM D5x/E5x Family Datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/60001507C.pdf

.. _SAM E54 Xplained Pro Schematic:
http://ww1.microchip.com/downloads/en/DeviceDoc/SAME54-Xplained-Pro_Design-Documentation.zip
16 changes: 16 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/sam_e54_xpro-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2025 Microchip Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/sam/sam_d5x_e5x/same54/atsame54p20a-pinctrl.h>

&pinctrl {
sercom2_uart_default: sercom2_uart_default {
group1 {
pinmux = <PB25D_SERCOM2_PAD0>,
<PB24D_SERCOM2_PAD1>;
};
};
};
63 changes: 63 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/sam_e54_xpro.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2025 Microchip Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <microchip/sam/sam_d5x_e5x/same54/atsame54p20a.dtsi>
#include "sam_e54_xpro-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
model = "SAM E54 Xplained Pro";
compatible = "same54,xpro", "microchip,atsame54p20a", "microchip,same54";

chosen {
zephyr,console = &sercom2;
zephyr,shell-uart = &sercom2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
};

&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@fc000 {
label = "storage";
reg = <0x000fc000 0x00004000>;
};
};
};

&cpu0 {
clock-frequency = <48000000>;
};

&sercom2 {
status = "okay";
compatible = "microchip,sercom-g1-uart";

current-speed = <115200>;
data-bits = <8>;
parity = "none";
stop-bits = "1";

rxpo = <1>;
txpo = <0>;

#address-cells = <1>;
#size-cells = <0>;

pinctrl-0 = <&sercom2_uart_default>;
pinctrl-names = "default";
};
18 changes: 18 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/sam_e54_xpro.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

identifier: sam_e54_xpro
name: SAM E54 Xplained Pro
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
flash: 1024
ram: 256
supported:
- pinctrl
- shell
- uart
vendor: microchip
11 changes: 11 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/sam_e54_xpro_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

CONFIG_BUILD_OUTPUT_HEX=y

CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y

CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
25 changes: 25 additions & 0 deletions boards/microchip/sam/sam_e54_xpro/support/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0
source [find interface/cmsis-dap.cfg]
transport select swd

# chip name
set CHIPNAME same54p20a
set ENDIAN little
set CPUTAPID 0x0bc11477

source [find target/atsame5x.cfg]

reset_config none
cortex_m reset_config sysresetreq

$_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
}
1 change: 1 addition & 0 deletions drivers/clock_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_FIXED_RATE_CLOCK clock_cont
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_GD32 clock_control_gd32.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_LITEX clock_control_litex.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_LPC11U6X clock_control_lpc11u6x.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCHP_SAM_D5X_E5X clock_mchp_sam_d5x_e5x.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCHP_XEC clock_control_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_CCM clock_control_mcux_ccm.c)
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_CCM_REV2 clock_control_mcux_ccm_rev2.c)
Expand Down
2 changes: 2 additions & 0 deletions drivers/clock_control/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,6 @@ source "drivers/clock_control/Kconfig.wch_rcc"

source "drivers/clock_control/Kconfig.it51xxx"

source "drivers/clock_control/Kconfig.mchp"

endif # CLOCK_CONTROL
32 changes: 32 additions & 0 deletions drivers/clock_control/Kconfig.mchp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2025 Microchip Technology Inc.
# SPDX-License-Identifier: Apache-2.0

# Symbol for enabling clock driver for a family
config CLOCK_CONTROL_MCHP_SAM_D5X_E5X
bool
default y
depends on DT_HAS_MICROCHIP_SAM_D5X_E5X_CLOCK_ENABLED
help
This symbol define clock driver for Microchip SAM_D5X_E5X family.

# Define menu symbol for configuring clock features
menuconfig CLOCK_CONTROL_MCHP
bool "Microchip clock controller driver"
default y
depends on CLOCK_CONTROL_MCHP_SAM_D5X_E5X
help
Enable support for Microchip clock controller driver.

# Common features for all SOC families
if CLOCK_CONTROL_MCHP

# Enable get rate API. Since, clock rate for multiple levels of clock sources are to be
# calculated, this feature consumes some program size, and can be optional.
config CLOCK_CONTROL_MCHP_GET_RATE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this special ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the clock rates for multiple levels of clock sources need to be calculated, this feature increases the program size. Therefore, it has been made optional, allowing the user to decide whether to enable it.

bool "Get clock rate"
default y
help
This option enables get rate API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


endif # CLOCK_CONTROL_MCHP
Loading