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

boards/nucleo-l552ze: add PWM configuration #20032

Merged
merged 2 commits into from
Oct 31, 2023
Merged
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
1 change: 1 addition & 0 deletions boards/nucleo-l552ze-q/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ config BOARD_NUCLEO_L552ZE_Q
# Put defined MCU peripherals here (in alphabetical order)
select HAS_PERIPH_I2C
select HAS_PERIPH_LPUART
select HAS_PERIPH_PWM
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
Expand Down
1 change: 1 addition & 0 deletions boards/nucleo-l552ze-q/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CPU_MODEL = stm32l552ze
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart periph_lpuart

Expand Down
53 changes: 53 additions & 0 deletions boards/nucleo-l552ze-q/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,59 @@
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */


Check warning on line 97 in boards/nucleo-l552ze-q/include/periph_conf.h

View workflow job for this annotation

GitHub Actions / static-tests

too many consecutive empty lines
/**
* @name PWM configuration
*
* To find appriopate device and channel find in the MCU datasheet table
* concerning "Alternate function AF0 to AF7" a text similar to TIM[X]_CH[Y],
* where:
* TIM[X] - is device,
* [Y] - describes used channel (indexed from 0), for example TIM2_CH1 is
* channel 0 in configuration structure (cc_chan - field),
* Port column in the table describes connected port.
*
* For Nucleo-L552ZE-Q this information is in the datasheet, Table 22, page 122.
*
* @{
*/
static const pwm_conf_t pwm_config[] = {
{
.dev = TIM2,
.rcc_mask = RCC_APB1ENR1_TIM2EN,
.chan = { { .pin = GPIO_PIN(PORT_A, 0) /* CN10 D32 */, .cc_chan = 0},
{ .pin = GPIO_PIN(PORT_A, 1) /* CN10 A8 */, .cc_chan = 1},
{ .pin = GPIO_PIN(PORT_A, 2) /* CN9 A1 */, .cc_chan = 2},
{ .pin = GPIO_PIN(PORT_A, 3) /* CN9 A0 */, .cc_chan = 3} },
.af = GPIO_AF1,
.bus = APB1
},
{
.dev = TIM3,
.rcc_mask = RCC_APB1ENR1_TIM3EN,
.chan = { { .pin = GPIO_PIN(PORT_B, 4) /* CN7 D25 */, .cc_chan = 0},
{ .pin = GPIO_PIN(PORT_B, 5) /* CN7 D22 */, .cc_chan = 1},
{ .pin = GPIO_PIN(PORT_B, 0) /* CN9 A3 */, .cc_chan = 2},
{ .pin = GPIO_PIN(PORT_B, 1) /* CN10 A6 */, .cc_chan = 3} },
.af = GPIO_AF2,
.bus = APB1
},
{
.dev = TIM4,
.rcc_mask = RCC_APB1ENR1_TIM4EN,
.chan = { { .pin = GPIO_PIN(PORT_D, 12) /* CN7 D19 */, .cc_chan = 0},
{ .pin = GPIO_PIN(PORT_B, 7) /* Blue LD2 */, .cc_chan = 1},
{ .pin = GPIO_PIN(PORT_D, 14) /* CN7 D10 */, .cc_chan = 2},
{ .pin = GPIO_PIN(PORT_D, 15) /* CN7 D9 */, .cc_chan = 3} },
.af = GPIO_AF2,
.bus = APB1
},
};

#define PWM_NUMOF ARRAY_SIZE(pwm_config)

/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
Loading