Skip to content

soc: microchip: Introduce pic32cxsg sg41 #86952

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 8 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
27 changes: 27 additions & 0 deletions boards/microchip/pic32cxsg41_cult/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# PIC32CX SG41 Curiosity Ultra board configuration
#
# Copyright (c) 2024 Microchip
# SPDX-License-Identifier: Apache-2.0

if ETH_SAM_GMAC
Copy link
Member

Choose a reason for hiding this comment

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

This is not essential.


# Read MAC address from AT24MAC402 EEPROM

config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS
default 0x9A

config ETH_SAM_GMAC_MAC_I2C_INT_ADDRESS_SIZE
default 1

config ETH_SAM_GMAC_MAC_I2C_EEPROM
default y
select I2C

endif # ETH_SAM_GMAC

if NETWORKING

config NET_L2_ETHERNET
default y

endif # NETWORKING
5 changes: 5 additions & 0 deletions boards/microchip/pic32cxsg41_cult/Kconfig.pic32cxsg41_cult
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Microchip
# SPDX-License-Identifier: Apache-2.0

config BOARD_PIC32CXSG41_CULT
select SOC_PIC32CX1025SG41128
6 changes: 6 additions & 0 deletions boards/microchip/pic32cxsg41_cult/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 Microchip

# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
board_finalize_runner_args(jlink "--device=pic32cx1025sg41128")
6 changes: 6 additions & 0 deletions boards/microchip/pic32cxsg41_cult/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: pic32cxsg41_cult
full_name: PIC32CX SG41 Curiosity Ultra Evaluation Kit
vendor: microchip
socs:
- name: pic32cx1025sg41128
5 changes: 5 additions & 0 deletions boards/microchip/pic32cxsg41_cult/board_jlink.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Microchip
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
board_finalize_runner_args(jlink "--device=pic32cx1025sg41128")
Binary file not shown.
Binary file not shown.
Binary file not shown.
166 changes: 166 additions & 0 deletions boards/microchip/pic32cxsg41_cult/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
.. zephyr:board:: pic32cxsg41_cult

Overview
********

The PIC32CX SG41 Curiosity Ultra evaluation kit is ideal for evaluation and
prototyping with the PIC32CX SG 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.

Hardware
********

- PIC32CX1025SG41 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
- Two yellow user LEDs
- Two mechanical user push buttons
- One reset button
- On-board USB based EDBG unit with serial console
- Embedded Debugger MCU (PKoB4)
- 64 Mbit QSPI Flash
- AT24MAC402 serial EEPROM with EUI-48™ MAC address
- Ethernet transceiver 10/100 Mbps Ethernet MAC,
compatible with the IEEE 802.3 standard.
- Arduino Uno header connectors
- X32 Audio Interface Headers
- mikroBUS header connectors
- DAC Output header
- USB interface, host, and device
- SD/SDIO card connector

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

.. zephyr:board-supported-hw::

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

The Microchip PIC32CXSG41 Curiosity Ultra evaluation kit has 4 GPIO controllers. These
controllers are responsible for pin muxing, input/output, pull-up, etc.

For more details please refer to `Microchip PIC32CX SG41-SG60-SG61 Family Datasheet`_.

.. image:: img/PIC32CXSG41-pinout1.webp
:align: center
:alt: PIC32CXSG41-CULT-pinout1

.. image:: img/PIC32CXSG41-pinout2.webp
:align: center
:alt: PIC32CXSG41-CULT-pinout2

.. image:: img/PIC32CXSG41-pinout3.webp
:align: center
:alt: PIC32CXSG41-CULT-pinout3

Default Zephyr Peripheral Mapping:
----------------------------------

- SERCOM2 USART TX : PB13
- SERCOM2 USART RX : PB12
- GPIO/PWM LED1 : PC21
- GPIO/PWM LED2 : PA16
- GPIO SW1 : PD00
- GPIO SW2 : PD01
- 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
- SERCOM0 SPI SCK : PB24
- SERCOM0 SPI MOSI : PB25
- SERCOM0 SPI MISO : PC25
- SERCOM0 SPI SS : PC24
- SERCOM7 I2C SDA : PD08
- SERCOM7 I2C SCL : PD09
- USB DP : PA25
- USB DM : PA24

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

The PIC32CXSG41 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 PIC32CXSG41 MCU has 8 SERCOM based USARTs with one configured as USARTs in this BSP.
- SERCOM4 is the default Zephyr console.

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

The PIC32CXSG41 MCU has 8 SERCOM based SPIs.

The PIC32CXSG41 MCU has 5 SERCOM based I2Cs. On the Microchip PIC32CXSG41 Curiosity Ultra,
SERCOM7 is connected to a AT24MAC402 EEPROM.

Programming and Debugging
=========================

.. zephyr:board-supported-runners::

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
.. zephyr:board-supported-runners::

Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't appear to have been done 1 month later?

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@nordicjm @kartben Please mark as Resolved. Thanks.

The Microchip PIC32CXSG41 Curiosity Ultra comes with a Microchip Embedded Debugger (EDBG).
This provides a debug interface to the PIC32CXSG41 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: pic32cxsg41_cult
:goals: build
:compact:

Connect the Microchip PIC32CXSG41 Curiosity Ultra to your host computer using the USB debug port.

Run your favorite terminal program to listen for output. Under Linux thet terminal should be.

.. 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: pic32cxsg41_cult
:goals: flash
:compact:

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

Debugging
=========

SVD files are included in hal_microchip/pic32c/pic32cxsg/include/pic32cxsg41/svd.

References
**********

.. target-notes::

.. _Microchip website:
https://www.microchip.com/en-us/development-tool/EV06X38A

.. _Microchip PIC32CX SG41-SG60-SG61 Family Datasheet:
https://ww1.microchip.com/downloads/aemDocuments/documents/MCU32/ProductDocuments/DataSheets/PIC32CX-SG41-SG60-SG61-Family-Data-Sheet-DS60001715.pdf
63 changes: 63 additions & 0 deletions boards/microchip/pic32cxsg41_cult/pic32cxsg41_cult-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2024 Microchip
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/pic32cx1025sg41128-pinctrl.h>

&pinctrl {
pwm_default: pwm_default {
group1 {
pinmux = <PC18F_TCC0_WO2>;
};
};

gmac_rmii: gmac_rmii {
group1 {
pinmux = <PA14L_GMAC_GTXCK>,
<PA17L_GMAC_GTXEN>,
<PA18L_GMAC_GTX0>,
<PA19L_GMAC_GTX1>,
<PC20L_GMAC_GRXDV>,
<PA13L_GMAC_GRX0>,
<PA12L_GMAC_GRX1>,
<PA15L_GMAC_GRXER>;
};
};

mdio_default: mdio_default {
group1 {
pinmux = <PC22L_GMAC_GMDC>,
<PC23L_GMAC_GMDIO>;
};
};

sercom7_i2c_default: sercom7_i2c_default {
group1 {
pinmux = <PD8C_SERCOM7_PAD0>,
<PD9C_SERCOM7_PAD1>;
};
};

sercom0_spi_default: sercom0_spi_default {
group1 {
pinmux = <PB24C_SERCOM0_PAD0>,
<PB25C_SERCOM0_PAD1>,
<PC25C_SERCOM0_PAD3>;
};
};

sercom4_uart_default: sercom4_uart_default {
group1 {
pinmux = <PB12C_SERCOM4_PAD0>,
<PB13C_SERCOM4_PAD1>;
};
};

usb_dc_default: usb_dc_default {
group1 {
pinmux = <PA25H_USB_DP>,
<PA24H_USB_DM>;
};
};
};
Loading
Loading