boards: mr_canhubk3: enable NXP S32 EMIOS PWM
In this board, there are eight PWM channels from EMIOS 0 CH0 --> EMIOS 0 CH7 that can be used to generate PWM pulse to outside of the board. Moreover, there are three RGB leds that can use PWM pins for blinking, faded leds Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
This commit is contained in:
parent
92f3fb79fe
commit
b92ad4b56a
6 changed files with 203 additions and 1 deletions
|
@ -56,6 +56,7 @@ ADC SAR on-chip adc
|
||||||
LPSPI on-chip spi
|
LPSPI on-chip spi
|
||||||
WDT FS26 SBC watchdog
|
WDT FS26 SBC watchdog
|
||||||
EMAC on-chip ethernet
|
EMAC on-chip ethernet
|
||||||
|
eMIOS on-chip pwm
|
||||||
============ ========== ================================
|
============ ========== ================================
|
||||||
|
|
||||||
The default configuration can be found in the Kconfig file
|
The default configuration can be found in the Kconfig file
|
||||||
|
|
|
@ -267,6 +267,24 @@
|
||||||
pinmux = <PTB5_EMAC_MII_RMII_TXD0>,
|
pinmux = <PTB5_EMAC_MII_RMII_TXD0>,
|
||||||
<PTB4_EMAC_MII_RMII_TXD1>,
|
<PTB4_EMAC_MII_RMII_TXD1>,
|
||||||
<PTE9_EMAC_MII_RMII_TX_EN>;
|
<PTE9_EMAC_MII_RMII_TX_EN>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
emios0_default: emios0_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PTB12_EMIOS_0_CH0_X_O>, <PTB13_EMIOS_0_CH1_G_O>,
|
||||||
|
<PTB14_EMIOS_0_CH2_G_O>, <PTB15_EMIOS_0_CH3_G_O>,
|
||||||
|
<PTB16_EMIOS_0_CH4_G_O>, <PTB17_EMIOS_0_CH5_G_O>,
|
||||||
|
<PTA17_EMIOS_0_CH6_G_O>, <PTE7_EMIOS_0_CH7_G_O>,
|
||||||
|
<PTE14_EMIOS_0_CH19_Y_O>;
|
||||||
|
output-enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
emios1_default: emios1_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PTA27_EMIOS_1_CH10_H_O>,
|
||||||
|
<PTE12_EMIOS_1_CH5_H_O>;
|
||||||
output-enable;
|
output-enable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <dt-bindings/gpio/gpio.h>
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
#include <zephyr/dt-bindings/input/input-event-codes.h>
|
#include <zephyr/dt-bindings/input/input-event-codes.h>
|
||||||
#include <freq.h>
|
#include <freq.h>
|
||||||
|
#include <dt-bindings/pwm/pwm.h>
|
||||||
#include "mr_canhubk3-pinctrl.dtsi"
|
#include "mr_canhubk3-pinctrl.dtsi"
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
@ -34,6 +35,12 @@
|
||||||
sw0 = &user_button_1;
|
sw0 = &user_button_1;
|
||||||
sw1 = &user_button_2;
|
sw1 = &user_button_2;
|
||||||
watchdog0 = &fs26_wdt;
|
watchdog0 = &fs26_wdt;
|
||||||
|
/* For pwm test suites */
|
||||||
|
pwm-0 = &emios0_pwm;
|
||||||
|
red-pwm-led = &user_led1_red_pwm;
|
||||||
|
green-pwm-led = &user_led1_green_pwm;
|
||||||
|
blue-pwm-led = &user_led1_blue_pwm;
|
||||||
|
pwm-led0 = &user_led1_blue_pwm;
|
||||||
};
|
};
|
||||||
|
|
||||||
leds {
|
leds {
|
||||||
|
@ -52,6 +59,23 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* gpio-leds and pwm-leds are the same RGB LED and cannot be used at the same time. */
|
||||||
|
pwmleds {
|
||||||
|
compatible = "pwm-leds";
|
||||||
|
|
||||||
|
user_led1_blue_pwm: user_led1_blue {
|
||||||
|
pwms = <&emios1_pwm 5 PWM_MSEC(20)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
user_led1_green_pwm: user_led1_green {
|
||||||
|
pwms = <&emios1_pwm 10 PWM_MSEC(20)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
user_led1_red_pwm: user_led1_red {
|
||||||
|
pwms = <&emios0_pwm 19 PWM_MSEC(20)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
gpio_keys {
|
gpio_keys {
|
||||||
compatible = "gpio-keys";
|
compatible = "gpio-keys";
|
||||||
user_button_1: button_0 {
|
user_button_1: button_0 {
|
||||||
|
@ -378,3 +402,155 @@
|
||||||
full-duplex;
|
full-duplex;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&emios0 {
|
||||||
|
clock-divider = <200>;
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
master_bus {
|
||||||
|
/*
|
||||||
|
* Timebase for PWM led, setting clock 50KHz for internal counter,
|
||||||
|
* default period is 1000 cycles <-> 20ms.
|
||||||
|
*/
|
||||||
|
emios0_bus_a {
|
||||||
|
mode = "MCB_UP_COUNTER";
|
||||||
|
prescaler = <16>;
|
||||||
|
period = <1000>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
emios0_pwm: pwm {
|
||||||
|
pinctrl-0 = <&emios0_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
/* Default clock for internal counter for PWM channel 0-7 is 100Khz */
|
||||||
|
pwm_0 {
|
||||||
|
channel = <0>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_1 {
|
||||||
|
channel = <1>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_2 {
|
||||||
|
channel = <2>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_3 {
|
||||||
|
channel = <3>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_4 {
|
||||||
|
channel = <4>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_5 {
|
||||||
|
channel = <5>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_6 {
|
||||||
|
channel = <6>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
pwm_7 {
|
||||||
|
channel = <7>;
|
||||||
|
pwm-mode = "MODE_OPWFMB";
|
||||||
|
period = <65535>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
prescaler = <8>;
|
||||||
|
polarity = "ACTIVE_HIGH";
|
||||||
|
};
|
||||||
|
|
||||||
|
rgb_red {
|
||||||
|
channel = <19>;
|
||||||
|
master-bus = <&emios0_bus_a>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
pwm-mode = "MODE_OPWMB";
|
||||||
|
polarity = "ACTIVE_LOW";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&emios1 {
|
||||||
|
clock-divider = <200>;
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
master_bus {
|
||||||
|
/*
|
||||||
|
* Timebase for PWM led, setting clock 50KHz for internal counter,
|
||||||
|
* default period is 1000 cycles <-> 20ms.
|
||||||
|
*/
|
||||||
|
emios1_bus_a {
|
||||||
|
prescaler = <16>;
|
||||||
|
mode = "MCB_UP_COUNTER";
|
||||||
|
period = <1000>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
emios1_bus_f {
|
||||||
|
prescaler = <16>;
|
||||||
|
mode = "MCB_UP_COUNTER";
|
||||||
|
period = <1000>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
emios1_pwm: pwm {
|
||||||
|
pinctrl-0 = <&emios1_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
rgb_green {
|
||||||
|
channel = <10>;
|
||||||
|
master-bus = <&emios1_bus_a>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
pwm-mode = "MODE_OPWMB";
|
||||||
|
polarity = "ACTIVE_LOW";
|
||||||
|
};
|
||||||
|
|
||||||
|
rgb_blue {
|
||||||
|
channel = <5>;
|
||||||
|
master-bus = <&emios1_bus_f>;
|
||||||
|
duty-cycle = <0>;
|
||||||
|
pwm-mode = "MODE_OPWMB";
|
||||||
|
polarity = "ACTIVE_LOW";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -18,3 +18,4 @@ supported:
|
||||||
- spi
|
- spi
|
||||||
- watchdog
|
- watchdog
|
||||||
- netif:eth
|
- netif:eth
|
||||||
|
- pwm
|
||||||
|
|
6
samples/drivers/led_pwm/boards/mr_canhubk3.conf
Normal file
6
samples/drivers/led_pwm/boards/mr_canhubk3.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Copyright 2023 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Due to gpio-leds and pwm-leds are the same RGB LEDs so should not be used
|
||||||
|
# at the same time, need to disable this config when using pwm-leds.
|
||||||
|
CONFIG_LED_GPIO=n
|
2
west.yml
2
west.yml
|
@ -193,7 +193,7 @@ manifest:
|
||||||
groups:
|
groups:
|
||||||
- hal
|
- hal
|
||||||
- name: hal_nxp
|
- name: hal_nxp
|
||||||
revision: b0274481021b6343740f1970ef167d65ea67d30b
|
revision: 0ef57e8ee40f02f1dce4b4ad666c55885f941703
|
||||||
path: modules/hal/nxp
|
path: modules/hal/nxp
|
||||||
groups:
|
groups:
|
||||||
- hal
|
- hal
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue