boards: lpcxpresso55s69: Add PWM support
Add PWM support Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
265cdf8dc6
commit
34ffd5a7d4
7 changed files with 64 additions and 3 deletions
|
@ -86,6 +86,8 @@ features:
|
|||
+-----------+------------+-------------------------------------+
|
||||
| I2S | on-chip | i2s |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| PWM | on-chip | pwm |
|
||||
+-----------+------------+-------------------------------------+
|
||||
|
||||
Targets available
|
||||
==================
|
||||
|
@ -153,6 +155,8 @@ functionality of a pin.
|
|||
+---------+-----------------+----------------------------+
|
||||
| PIO1_13 | I2S | I2S DATAIN |
|
||||
+---------+-----------------+----------------------------+
|
||||
| PIO0_15 | SCT0_OUT2 | PWM |
|
||||
+---------+-----------------+----------------------------+
|
||||
|
||||
Memory mappings
|
||||
===============
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <nxp/nxp_lpc55S6x.dtsi>
|
||||
#include "lpcxpresso55s69.dtsi"
|
||||
#include <dt-bindings/pwm/pwm.h>
|
||||
|
||||
/ {
|
||||
model = "NXP LPCXpresso55S69 board";
|
||||
|
@ -21,6 +22,10 @@
|
|||
sw0 = &user_button_1;
|
||||
sw1 = &user_button_2;
|
||||
sw2 = &user_button_3;
|
||||
/* For pwm test suites */
|
||||
pwm-0 = &sc_timer;
|
||||
pwm-led0 = &red_pwm_led;
|
||||
red-pwm-led = &red_pwm_led;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
@ -49,6 +54,15 @@
|
|||
gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
pwmleds {
|
||||
compatible = "pwm-leds";
|
||||
red_pwm_led: red_pwm_led {
|
||||
pwms = <&sc_timer 0 PWM_POLARITY_NORMAL>;
|
||||
label = "Red PWM LED";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
|
@ -151,3 +165,7 @@ i2s1: &flexcomm7 {
|
|||
dmas = <&dma0 19>;
|
||||
dma-names = "tx";
|
||||
};
|
||||
|
||||
&sc_timer {
|
||||
status = "okay";
|
||||
};
|
||||
|
|
|
@ -245,6 +245,28 @@ static int lpcxpresso_55s69_pinmux_init(const struct device *dev)
|
|||
IOCON_PIO_DIGITAL_EN |
|
||||
IOCON_PIO_OPENDRAIN_DI);
|
||||
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(sc_timer), nxp_sctimer_pwm, okay) && CONFIG_PWM
|
||||
/* Pin is configured as SCT0_OUT2 */
|
||||
pinmux_pin_set(port0, 15, IOCON_PIO_FUNC4 |
|
||||
IOCON_PIO_MODE_INACT |
|
||||
IOCON_PIO_SLEW_STANDARD |
|
||||
IOCON_PIO_INV_DI |
|
||||
IOCON_PIO_DIGITAL_EN |
|
||||
IOCON_PIO_OPENDRAIN_DI |
|
||||
IOCON_PIO_ASW_EN);
|
||||
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(red_pwm_led), okay)
|
||||
/* Pin is configured as SCT0_OUT0 */
|
||||
pinmux_pin_set(port1, 4, IOCON_PIO_FUNC4 |
|
||||
IOCON_PIO_MODE_INACT |
|
||||
IOCON_PIO_SLEW_STANDARD |
|
||||
IOCON_PIO_INV_DI |
|
||||
IOCON_PIO_DIGITAL_EN |
|
||||
IOCON_PIO_OPENDRAIN_DI);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -375,6 +375,16 @@
|
|||
prescale = <0>;
|
||||
label = "CTIMER_4";
|
||||
};
|
||||
|
||||
sc_timer: pwm@85000 {
|
||||
compatible = "nxp,sctimer-pwm";
|
||||
reg = <0x85000 0x1000>;
|
||||
interrupts = <12 0>;
|
||||
status = "disabled";
|
||||
prescaler = <2>;
|
||||
label = "SC_TIMER";
|
||||
#pwm-cells = <2>;
|
||||
};
|
||||
};
|
||||
|
||||
&nvic {
|
||||
|
|
|
@ -54,4 +54,8 @@ config I2S_MCUX_FLEXCOMM
|
|||
depends on I2S
|
||||
select INIT_PLL0
|
||||
|
||||
config PWM_MCUX_SCTIMER
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
endif # SOC_LPC55S69_CPU0
|
||||
|
|
|
@ -44,6 +44,7 @@ config SOC_LPC55S69_CPU0
|
|||
select HAS_MCUX_USB_LPCIP3511
|
||||
select USB_DEDICATED_MEMORY if USB_DEVICE_DRIVER
|
||||
select HAS_MCUX_CTIMER
|
||||
select HAS_MCUX_SCTIMER
|
||||
|
||||
config SOC_LPC55S69_CPU1
|
||||
bool "SOC_LPC55S69 M33 [CPU 1]"
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
|
||||
#define IOCON_PIO_FUNC2 0x02u /*!<@brief Selects pin function 1 */
|
||||
#define IOCON_PIO_FUNC2 0x02u /*!<@brief Selects pin function 2 */
|
||||
#define IOCON_PIO_FUNC4 0x04u /*!<@brief Selects pin function 4 */
|
||||
#define IOCON_PIO_FUNC5 0x05u /*!<@brief Selects pin function 5 */
|
||||
#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 5 */
|
||||
#define IOCON_PIO_FUNC6 0x06u /*!<@brief Selects pin function 6 */
|
||||
#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */
|
||||
#define IOCON_PIO_FUNC9 0x09u /*!<@brief Selects pin function 9 */
|
||||
#define IOCON_PIO_FUNC10 0x0Au /*!<@brief Selects pin function 10 */
|
||||
#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function not inverted */
|
||||
|
@ -40,6 +41,7 @@
|
|||
#define IOCON_PIO_SLEW_FAST 0x40u /*!<@brief Fast slew rate mode */
|
||||
#define IOCON_PIO_MODE_PULLDOWN 0x10u /*!<@brief Selects pull-down function */
|
||||
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
|
||||
#define IOCON_PIO_ASW_EN 0x0400u /*!<@brief Analog switch is closed (enabled) */
|
||||
#define IOCON_PIO_INPFILT_OFF 0x1000u /*!<@brief Input filter disabled */
|
||||
|
||||
#endif /* _SOC__H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue