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

Board config: timer config simplifications #13871

Merged
merged 33 commits into from Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
db3947b
crazyflie: fix PWM channel ordering
bkueng Jan 13, 2020
657bf38
MultirotorMixer: allow for longer mixer geometry names (16 instead of 8)
bkueng Jan 13, 2020
b231bdd
io timer: remove some fields from io_timers_t and split out channel i…
bkueng Jan 3, 2020
b252311
io pins: avoid using GPIO_GPIOx_OUTPUT, use timer_io_channels instead
bkueng Jan 13, 2020
0adb510
px4_micro_hal: add PX4_MAKE_GPIO_INPUT and PX4_MAKE_GPIO_OUTPUT
bkueng Jan 3, 2020
ef928eb
px4_arch: add hw description constexpr util methods
bkueng Jan 3, 2020
9320eb9
crazyflie: use hw description methods for timer configuration
bkueng Jan 3, 2020
675b86e
durandal-v1: use hw description methods for timer configuration
bkueng Jan 28, 2020
959babf
nxp/fmuk66-v3: use hw description methods for timer configuration
bkueng Jan 3, 2020
8616242
fmu-v4: use hw description methods for timer configuration
bkueng Jan 3, 2020
6dd1f14
fmu-v5: use hw description methods for timer configuration
bkueng Jan 3, 2020
d457c63
io-v2: use hw description methods for timer configuration
bkueng Jan 3, 2020
d46aa03
stm32 io_timer: add support for 16 PWM outputs
bkueng Jan 7, 2020
5b82f6b
airmind/mindpx-v2: use hw description methods for timer configuration
bkueng Jan 28, 2020
b2f1e13
av/x-v1: use hw description methods for timer configuration
bkueng Jan 28, 2020
a159661
holybro/kakutef7: use hw description methods for timer configuration
bkueng Jan 28, 2020
84d7339
intel/aerofc-v1: use hw description methods for timer configuration
bkueng Jan 28, 2020
c6b9c08
modalai/fc-v1: use hw description methods for timer configuration
bkueng Jan 28, 2020
2c4c98e
mro/ctrl-zero-f7: use hw description methods for timer configuration
bkueng Jan 29, 2020
9a275ef
mro/x21-777: use hw description methods for timer configuration
bkueng Jan 29, 2020
df08c2c
mro/x21: use hw description methods for timer configuration
bkueng Jan 29, 2020
5bc9eb4
omnibus/f4sd: use hw description methods for timer configuration
bkueng Jan 29, 2020
5356b0d
px4/fmu-v2: use hw description methods for timer configuration
bkueng Jan 29, 2020
00abc07
px4/fmu-v3: use hw description methods for timer configuration
bkueng Jan 29, 2020
51dadc1
px4/fmu-v4pro: use hw description methods for timer configuration
bkueng Jan 29, 2020
6c1bd46
px4/fmu-v5x: use hw description methods for timer configuration
bkueng Jan 29, 2020
ae1b456
uvify/core: use hw description methods for timer configuration
bkueng Jan 29, 2020
7634dad
nuttx configs: disable nuttx timers which are used for PWM output
bkueng Jan 29, 2020
8b661ce
imxrt io_timer: remove some fields from io_timers_t and split out cha…
bkueng Jan 13, 2020
6d5aceb
px4_arch imxrt: add hw description constexpr util methods
bkueng Jan 31, 2020
e7ebea0
io_timer_init.h: avoid using timer_channel, as imxrt does not have it
bkueng Jan 31, 2020
90b3822
nxp/fmurt1062-v1: use hw description methods for timer configuration
bkueng Jan 13, 2020
aa224a0
px4io: fix argv index & avoid empty 'unknown argument: ' warning
bkueng Feb 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie
Expand Up @@ -17,7 +17,7 @@
#
sh /etc/init.d/rc.mc_defaults

set MIXER quad_x
set MIXER quad_x_cw
set PWM_OUT 1234
if [ $AUTOCNF = yes ]
then
Expand Down
1 change: 1 addition & 0 deletions ROMFS/px4fmu_common/mixers/CMakeLists.txt
Expand Up @@ -71,6 +71,7 @@ px4_add_romfs_files(
quad_+_vtol.main.mix
quad_w.main.mix
quad_x.main.mix
quad_x_cw.main.mix
quad_x_vtol.main.mix
stampede.main.mix
tri_y_yaw-.main.mix
Expand Down
5 changes: 5 additions & 0 deletions ROMFS/px4fmu_common/mixers/quad_x_cw.main.mix
@@ -0,0 +1,5 @@
# @board px4_fmu-v2 exclude
# Quad X with clock-wise motor assigment

R: 4xcw 10000 10000 10000 0

2 changes: 0 additions & 2 deletions boards/airmind/mindpx-v2/nuttx-config/nsh/defconfig
Expand Up @@ -191,9 +191,7 @@ CONFIG_STM32_SPI2=y
CONFIG_STM32_SPI4=y
CONFIG_STM32_TIM10=y
CONFIG_STM32_TIM11=y
CONFIG_STM32_TIM1=y
CONFIG_STM32_TIM3=y
CONFIG_STM32_TIM4=y
CONFIG_STM32_TIM9=y
CONFIG_STM32_UART4=y
CONFIG_STM32_UART7=y
Expand Down
2 changes: 1 addition & 1 deletion boards/airmind/mindpx-v2/src/CMakeLists.txt
Expand Up @@ -36,7 +36,7 @@ add_library(drivers_board
init.c
led.c
spi.c
timer_config.c
timer_config.cpp
usb.c
)

Expand Down
55 changes: 1 addition & 54 deletions boards/airmind/mindpx-v2/src/board_config.h
Expand Up @@ -190,63 +190,10 @@
#define GPIO_TONE_ALARM (GPIO_ALT|GPIO_AF9|GPIO_SPEED_2MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN7)

/* AUX PWMs
*
* 8 PWM outputs are configured.
*
* Pins:
*
* CH1 : PE9 : TIM1_CH1
* CH2 : PE11 : TIM1_CH2
* CH3 : PE13 : TIM1_CH3
* CH4 : PE14 : TIM1_CH4
* CH5 : PD12 : TIM4_CH1
* CH6 : PD13 : TIM4_CH2
* CH7 : PD14 : TIM4_CH3
* CH8 : PD15 : TIM4_CH4
*/
#define GPIO_TIM1_CH1OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN9)
#define GPIO_TIM1_CH2OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN11)
#define GPIO_TIM1_CH3OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN13)
#define GPIO_TIM1_CH4OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN14)
#define GPIO_TIM4_CH1OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN12)
#define GPIO_TIM4_CH2OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN13)
#define GPIO_TIM4_CH3OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN14)
#define GPIO_TIM4_CH4OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN15)
#define DIRECT_PWM_OUTPUT_CHANNELS 8

#define GPIO_TIM1_CH1IN GPIO_TIM1_CH1IN_2
#define GPIO_TIM1_CH2IN GPIO_TIM1_CH2IN_2
#define GPIO_TIM1_CH3IN GPIO_TIM1_CH3IN_2
#define GPIO_TIM1_CH4IN GPIO_TIM1_CH4IN_2
#define GPIO_TIM4_CH1IN GPIO_TIM4_CH1IN_2
#define GPIO_TIM4_CH2IN GPIO_TIM4_CH2IN_2
#define GPIO_TIM4_CH3IN GPIO_TIM4_CH3IN_2
#define GPIO_TIM4_CH4IN GPIO_TIM4_CH4IN_2

#define DIRECT_INPUT_TIMER_CHANNELS 8


/* PWMs for main output */
/* TODO: implement a new driver - /dev/pwm_output0 */
#define GPIO_TIM2_CH1OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN15)
#define GPIO_TIM2_CH2OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN3)
#define GPIO_TIM2_CH3OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN2)
#define GPIO_TIM2_CH4OUT (GPIO_ALT|GPIO_AF1|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN3)
#define GPIO_TIM3_CH1OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN4)
#define GPIO_TIM3_CH2OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN7)
#define GPIO_TIM3_CH3OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
#define GPIO_TIM3_CH4OUT (GPIO_ALT|GPIO_AF2|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)

#define GPIO_TIM2_CH1IN GPIO_TIM2_CH1IN_2
#define GPIO_TIM2_CH2IN GPIO_TIM2_CH2IN_2
#define GPIO_TIM2_CH3IN GPIO_TIM2_CH3IN_1
#define GPIO_TIM2_CH4IN GPIO_TIM2_CH4IN_1
#define GPIO_TIM3_CH1IN GPIO_TIM3_CH1IN_2
#define GPIO_TIM3_CH2IN GPIO_TIM3_CH2IN_3
#define GPIO_TIM3_CH3IN GPIO_TIM3_CH3IN_1
#define GPIO_TIM3_CH4IN GPIO_TIM3_CH4IN_1


/* USB OTG FS
*
* PA9 OTG_FS_VBUS VBUS sensing
Expand All @@ -265,7 +212,7 @@
/* PWM input driver. Use FMU AUX5 pins attached to timer4 channel 1 */
#define PWMIN_TIMER 4
#define PWMIN_TIMER_CHANNEL 1
#define GPIO_PWM_IN GPIO_TIM4_CH1IN
#define GPIO_PWM_IN GPIO_TIM1_CH1IN_2

#define RC_SERIAL_PORT "/dev/ttyS0"

Expand Down
13 changes: 5 additions & 8 deletions boards/airmind/mindpx-v2/src/init.c
Expand Up @@ -73,6 +73,8 @@

#include <px4_platform_common/init.h>
#include <px4_platform/board_dma_alloc.h>
#include <drivers/drv_pwm_output.h>
#include <px4_arch/io_timer.h>

/****************************************************************************
* Pre-Processor Definitions
Expand Down Expand Up @@ -108,14 +110,9 @@ __END_DECLS
__EXPORT void board_on_reset(int status)
{
/* configure the GPIO pins to outputs and keep them low */
stm32_configgpio(GPIO_GPIO0_OUTPUT);
stm32_configgpio(GPIO_GPIO1_OUTPUT);
stm32_configgpio(GPIO_GPIO2_OUTPUT);
stm32_configgpio(GPIO_GPIO3_OUTPUT);
stm32_configgpio(GPIO_GPIO4_OUTPUT);
stm32_configgpio(GPIO_GPIO5_OUTPUT);
stm32_configgpio(GPIO_GPIO6_OUTPUT);
stm32_configgpio(GPIO_GPIO7_OUTPUT);
for (int i = 0; i < DIRECT_PWM_OUTPUT_CHANNELS; ++i) {
px4_arch_configgpio(io_timer_channel_get_gpio_output(i));
}

/**
* On resets invoked from system (not boot) insure we establish a low
Expand Down
141 changes: 0 additions & 141 deletions boards/airmind/mindpx-v2/src/timer_config.c

This file was deleted.

54 changes: 54 additions & 0 deletions boards/airmind/mindpx-v2/src/timer_config.cpp
@@ -0,0 +1,54 @@
/****************************************************************************
*
* Copyright (c) 2015, 2016 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/

#include <px4_arch/io_timer_hw_description.h>

constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
initIOTimer(Timer::Timer1),
initIOTimer(Timer::Timer4),
};

constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
initIOTimerChannelOutputClear(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortE, GPIO::Pin13}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer4, Timer::Channel1}, {GPIO::PortD, GPIO::Pin12}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}),
initIOTimerChannelOutputClear(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortD, GPIO::Pin15}),
};

constexpr io_timers_channel_mapping_t io_timers_channel_mapping =
initIOTimerChannelMapping(io_timers, timer_io_channels);

4 changes: 0 additions & 4 deletions boards/av/x-v1/nuttx-config/nsh/defconfig
Expand Up @@ -213,12 +213,8 @@ CONFIG_STM32F7_SPI1=y
CONFIG_STM32F7_SPI2=y
CONFIG_STM32F7_SPI4=y
CONFIG_STM32F7_SPI5=y
CONFIG_STM32F7_TIM10=y
CONFIG_STM32F7_TIM11=y
CONFIG_STM32F7_TIM14=y
CONFIG_STM32F7_TIM1=y
CONFIG_STM32F7_TIM3=y
CONFIG_STM32F7_TIM4=y
CONFIG_STM32F7_UART4=y
CONFIG_STM32F7_UART5=y
CONFIG_STM32F7_UART7=y
Expand Down
2 changes: 1 addition & 1 deletion boards/av/x-v1/src/CMakeLists.txt
Expand Up @@ -35,7 +35,7 @@ add_library(drivers_board
init.c
sdio.c
spi.cpp
timer_config.c
timer_config.cpp
)

target_link_libraries(drivers_board
Expand Down