diff options
| author | Hierophect <hierophect@gmail.com> | 2019-12-30 15:15:55 -0500 |
|---|---|---|
| committer | Hierophect <hierophect@gmail.com> | 2019-12-30 15:15:55 -0500 |
| commit | 28b1d718a36e02af4d1a7d68e92da3c942848a47 (patch) | |
| tree | 794815c92482ff6bc78ea00443e5ee9c89d0f19b | |
| parent | 5b9209aa022627abee714f360db5e93640689387 (diff) | |
Tests for PWM issues, style changes
| -rw-r--r-- | ports/stm32f4/boards/meowbit_v121/mpconfigboard.h | 2 | ||||
| -rw-r--r-- | ports/stm32f4/boards/meowbit_v121/pins.c | 2 | ||||
| -rw-r--r-- | ports/stm32f4/common-hal/pulseio/PWMOut.c | 5 | ||||
| -rw-r--r-- | ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c | 1 |
4 files changed, 8 insertions, 2 deletions
diff --git a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h index 89cdee6d9..e97d793be 100644 --- a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h +++ b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h @@ -36,7 +36,7 @@ #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) #define BOARD_OSC_DIV 12 -#define BOARD_NO_VBUS +#define BOARD_NO_VBUS_SENSE // On-board flash // #define SPI_FLASH_MOSI_PIN (&pin_PB15) diff --git a/ports/stm32f4/boards/meowbit_v121/pins.c b/ports/stm32f4/boards/meowbit_v121/pins.c index 8a798dcb4..7b896bd70 100644 --- a/ports/stm32f4/boards/meowbit_v121/pins.c +++ b/ports/stm32f4/boards/meowbit_v121/pins.c @@ -52,7 +52,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P9), MP_ROM_PTR(&pin_PC06) }, { MP_ROM_QSTR(MP_QSTR_P8), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_P1), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_PA10) }, //in use by USB { MP_ROM_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_PC07) }, { MP_ROM_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_PB05) }, { MP_ROM_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_PC01) }, diff --git a/ports/stm32f4/common-hal/pulseio/PWMOut.c b/ports/stm32f4/common-hal/pulseio/PWMOut.c index 16b1b5b89..301f8cd49 100644 --- a/ports/stm32f4/common-hal/pulseio/PWMOut.c +++ b/ports/stm32f4/common-hal/pulseio/PWMOut.c @@ -124,6 +124,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, uint16_t duty, uint32_t frequency, bool variable_frequency) { + mp_printf(&mp_plat_print, "Construct PWM\n"); TIM_TypeDef * TIMx; uint8_t tim_num = sizeof(mcu_tim_pin_list)/sizeof(*mcu_tim_pin_list); bool tim_chan_taken = false; @@ -194,6 +195,8 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, GPIO_InitStruct.Alternate = self->tim->altfn_index; HAL_GPIO_Init(pin_port(pin->port), &GPIO_InitStruct); + mp_printf(&mp_plat_print, "PWM Pin:%d Port:%d\n", pin->number, pin->port); + tim_clock_enable(1<<(self->tim->tim_index - 1)); //translate channel into handle value @@ -203,6 +206,8 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, uint32_t period = 0; //period is 16 bit timer_get_optimal_divisors(&period, &prescaler,frequency,timer_get_source_freq(self->tim->tim_index)); + mp_printf(&mp_plat_print, "Per:%d presc:%d\n", period, prescaler); + //Timer init self->handle.Instance = TIMx; self->handle.Init.Period = period - 1; diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c index 859e9a1ad..b12084186 100644 --- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c +++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c @@ -125,6 +125,7 @@ const mcu_uart_rx_obj_t mcu_uart_rx_list[6] = { TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10, TIM11, NULL, NULL, NULL}; +//#define TIM(index, alt, channel, tim_pin) const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = { TIM(2,1,1,&pin_PA00), TIM(5,2,1,&pin_PA00), |
