Skip to content
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

Add support for NXP S32K148 evaluation board #85555

Open
wants to merge 3 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
13 changes: 13 additions & 0 deletions boards/nxp/s32k148_evb/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023-2024 NXP
# SPDX-License-Identifier: Apache-2.0

if BOARD_S32K148_EVB

if SERIAL

config UART_CONSOLE
default y

endif # SERIAL

endif # BOARD_S32K148_EVB
6 changes: 6 additions & 0 deletions boards/nxp/s32k148_evb/Kconfig.s32k148_evb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2023-2024 NXP
# SPDX-License-Identifier: Apache-2.0

config BOARD_S32K148_EVB
select SOC_S32K148
select SOC_PART_NUMBER_FS32K148HAT0MLUT
6 changes: 6 additions & 0 deletions boards/nxp/s32k148_evb/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: s32k148_evb
full_name: S32K148EVB-Q176
vendor: nxp
socs:
- name: s32k148
Binary file added boards/nxp/s32k148_evb/doc/img/s32k148_evb.jpg
Copy link
Collaborator

Choose a reason for hiding this comment

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

convert to webp then put through https://tinypng.com/

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 203 additions & 0 deletions boards/nxp/s32k148_evb/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
.. zephyr:board:: s32k148_evb

Overview
********

`NXP S32K148-Q176`_ is a low-cost evaluation and development board for general-purpose industrial
and automotive applications.
The S32K148-Q176 is based on the 32-bit Arm Cortex-M4F `NXP S32K148`_ microcontroller.
The onboard OpenSDA serial and debug adapter, running a mass storage device (MSD) bootloader
and a collection of OpenSDA Applications, offers options for serial communication,
flash programming, and run-control debugging.
It is a bridge between a USB host and the embedded target processor.

Hardware
********

- NXP S32K148
- Arm Cortex-M4F @ up to 112 Mhz
- 1.5 MB Flash
- 256 KB SRAM
- up to 127 I/Os
- 3x FlexCAN with FD
- eDMA, 12-bit ADC, MPU, ECC and more.

- Interfaces:
- CAN, LIN, UART/SCI
- Ethernet connector compatible with different ethernet daughter cards
- 2 touchpads, potentiometer, user RGB LED and 2 buttons.

More information about the hardware and design resources can be found at
`NXP S32K148-Q176`_ website.

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

The ``s32k148_evb`` board configuration supports the following hardware features:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The ``s32k148_evb`` board configuration supports the following hardware features:
The ``s32k148_evb`` board supports the following hardware features:

Copy link
Collaborator

Choose a reason for hiding this comment

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

stop marking things as resolved if they are not resolved and fix the highlighted issue


+-----------+------------+------------------+
| Interface | Controller | Driver/Component |
+===========+============+==================+
| SYSMPU | on-chip | mpu |
+-----------+------------+------------------+
| PORT | on-chip | pinctrl |
+-----------+------------+------------------+
| GPIO | on-chip | gpio |
+-----------+------------+------------------+
| LPUART | on-chip | serial |
+-----------+------------+------------------+
| FTM | on-chip | pwm |
+-----------+------------+------------------+
| FlexCAN | on-chip | can |
+-----------+------------+------------------+
| Watchdog | on-chip | watchdog |
+-----------+------------+------------------+
| RTC | on-chip | counter |
+-----------+------------+------------------+
| ADC | on-chip | adc |
+-----------+------------+------------------+

The default configuration can be found in the Kconfig file
:zephyr_file:`boards/nxp/s32k148_evb/s32k148_evb_defconfig`.

.. note::
Before using the Ethernet interface, please take note of the following:
- For boards with the part number ``LSF24D`` at ``U16``, ``R553`` needs to be depopulated.

Connections and IOs
===================

This board has 5 GPIO ports named from ``gpioa`` to ``gpioe``.

Pin control can be further configured from your application overlay by adding
children nodes with the desired pinmux configuration to the singleton node
``pinctrl``. Supported properties are described in
:zephyr_file:`dts/bindings/pinctrl/nxp,port-pinctrl.yaml`.

LEDs
----

The NXP S32K148-Q176 board has one user RGB LED that can be used either as a GPIO
LED or as a PWM LED.

.. table:: RGB LED as GPIO LED
:widths: auto

=============== ================ =============== =====
Devicetree node Devicetree alias Label Pin
=============== ================ =============== =====
led1_red led0 LED1_RGB_RED PTE21
led1_green led1 LED1_RGB_GREEN PTE22
led1_blue led2 LED1_RGB_BLUE PTE23
=============== ================ =============== =====
Comment on lines +86 to +92
Copy link
Collaborator

Choose a reason for hiding this comment

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

tables do not look valid e.g.

    +-------------------+-----------------------------------------------+
    | ``Command ID``    | Command description                           |
    +===================+===============================================+
    | ``0``             | Echo                                          |
    +-------------------+-----------------------------------------------+

but doc build fails to not able to tell


.. table:: RGB LED as PWM LED
:widths: auto

=============== ======================== ================== ================
Devicetree node Devicetree alias Label Pin
=============== ======================== ================== ================
led1_red_pwm pwm-led0 / red-pwm-led LED1_RGB_RED_PWM PTE21 / FTM4_CH1
led1_green_pwm pwm-led1 / green-pwm-led LED1_RGB_GREEN_PWM PTE22 / FTM4_CH2
led1_blue_pwm pwm-led2 / blue-pwm-led LED1_RGB_BLUE_PWM PTE23 / FTM4_CH3
=============== ======================== ================== ================

The user can control the LEDs in any way. An output of ``0`` illuminates the LED.

Buttons
-------

The NXP S32K148-Q176 board has two user buttons:

+-----------------+-------+-------+
| Devicetree node | Label | Pin |
+=================+=======+=======+
| sw0 / button_3 | SW3 | PTC12 |
+-----------------+-------+-------+
| sw1 / button_4 | SW4 | PTC13 |
+-----------------+-------+-------+

Serial Console
==============

The serial console is provided via ``lpuart1`` on the OpenSDA adapter.

+------+--------------+
| Pin | Pin Function |
+======+==============+
| PTC7 | LPUART1_TX |
+------+--------------+
| PTC6 | LPUART1_RX |
+------+--------------+

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

The Arm Cortex-M4F core is configured to run at 80 MHz (RUN mode).

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

Applications for the ``s32k148_evb`` board can be built in the usual way as
documented in :ref:`build_an_application`.

Configuring a Debug adapter
===========================

This board integrates an OpenSDA debug adapter. It can be used for flashing and debugging.

Connect the USB cable to a PC and connect micro USB connector of the USB cable to micro-B port J24 on the ``s32k148_evb``.

In order to use NXP S32 Design Studio IDE install the debug host tools as in indicated in :ref:`nxp-s32-debug-host-tools`.

In order to use GDB, first install PEMicro USB driver:

- download `PEMicro USB driver`_
- Windows: run installation file, Linux: extract downloaded file and run ``setup.sh`` file

Next, download GDB Server Plug-In. It provides GDB remote debugging and flash programming support:

- download `GDB Server Plug-In for Eclipse-based ARM IDEs`_
- extract downloaded file
- unzip jar file ``com.pemicro.debug.gdbjtag.pne_X.X.X.XXXXXXXXXXXX.jar``

The server can be run using the following command:

.. code-block:: console

pegdbserver_console -startserver -device=NXP_S32K1xx_S32K148F2M0M11

Use this command to flash ``zephyr.elf`` file:

.. code-block:: console

(gdb) load zephyr.elf

Configuring a Console
=====================

We will use OpenSDA as a USB-to-serial adapter for the serial console.

Use the following settings with your serial terminal of choice (minicom, putty, etc.):

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

References
**********

.. target-notes::

.. _NXP S32K148-Q176:
https://www.nxp.com/design/design-center/development-boards-and-designs/automotive-development-platforms/s32k-mcu-platforms/s32k148-q176-evaluation-board-for-automotive-general-purpose:S32K148EVB

.. _NXP S32K148:
https://www.nxp.com/products/processors-and-microcontrollers/s32-automotive-platform/s32k-auto-general-purpose-mcus/s32k1-microcontrollers-for-automotive-general-purpose:S32K1

.. _GDB Server Plug-In for Eclipse-based ARM IDEs:
https://www.pemicro.com/products/product_viewDetails.cfm?product_id=15320151&productTab=1000000

.. _PEMicro USB driver:
https://www.pemicro.com/opensda/
86 changes: 86 additions & 0 deletions boards/nxp/s32k148_evb/s32k148_evb-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <nxp/s32/S32K148_LQFP176-pinctrl.h>

&pinctrl {
lpuart0_default: lpuart0_default {
group0 {
pinmux = <LPUART0_RX_PTA2>, <LPUART0_TX_PTA3>;
drive-strength = "low";
};
};

lpuart1_default: lpuart1_default {
group0 {
pinmux = <LPUART1_RX_PTC6>, <LPUART1_TX_PTC7>;
drive-strength = "low";
};
};

lpi2c0_default: lpi2c0_default {
group1 {
pinmux = <LPI2C0_SDAS_PTB10>, <LPI2C0_SCLS_PTB9>;
drive-strength = "low";
};
};

lpspi0_default: lpspi0_default {
group0 {
pinmux = <LPSPI0_SCK_PTB2>,
<LPSPI0_SIN_PTB3>,
<LPSPI0_SOUT_PTB1>,
<LPSPI0_PCS0_PTB0>;
drive-strength = "low";
};
};

ftm4_default: ftm4_default {
group0 {
pinmux = <FTM4_CH1_PTE21>,
<FTM4_CH2_PTE22>,
<FTM4_CH3_PTE23>;
drive-strength = "low";
};
};

flexcan0_default: flexcan0_default {
group0 {
pinmux = <CAN0_RX_PTE4>, <CAN0_TX_PTE5>;
drive-strength = "low";
};
};

pinmux_enet: pinmux_enet {
group1 {
pinmux = <MII_RMII_RX_ER_PTC16>,
<MII_RMII_RXD1_PTC0>,
<MII_RMII_RXD0_PTC1>,
<MII_RMII_RX_DV_PTC17>,
<MII_RMII_TX_EN_PTD12>,
<MII_RMII_TXD0_PTC2>,
<MII_RMII_TXD1_PTD7>,
<MII_RMII_TX_CLK_PTD11>;
drive-strength = "low";
slew-rate = "fast";
};
};

pinmux_enet_mdio: pinmux_enet_mdio {
group0 {
pinmux = <MII_RMII_MDIO_PTB4>;
drive-strength = "low";
drive-open-drain;
bias-pull-up;
slew-rate = "fast";
};
group1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

no spacing has been added

pinmux = <MII_RMII_MDC_PTB5>;
drive-strength = "low";
slew-rate = "fast";
};
};
};
Loading
Loading