mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 03:41:36 +08:00
px4_fmu-v6x_bootloader:Ensure PWM pins are low from boot
This commit is contained in:
committed by
Daniel Agar
parent
585e81fc30
commit
eaac84ab20
@@ -31,14 +31,19 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||||
|
add_compile_definitions(BOOTLOADER)
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
bootloader_main.c
|
bootloader_main.c
|
||||||
|
init.c
|
||||||
usb.c
|
usb.c
|
||||||
|
timer_config.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(drivers_board
|
target_link_libraries(drivers_board
|
||||||
PRIVATE
|
PRIVATE
|
||||||
nuttx_arch # sdio
|
nuttx_arch # sdio
|
||||||
nuttx_drivers # sdio
|
nuttx_drivers # sdio
|
||||||
|
px4_layer #gpio
|
||||||
|
arch_io_pins # iotimer
|
||||||
bootloader
|
bootloader
|
||||||
)
|
)
|
||||||
target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/bootloader/common)
|
target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/bootloader/common)
|
||||||
|
|||||||
@@ -50,19 +50,6 @@
|
|||||||
|
|
||||||
extern int sercon_main(int c, char **argv);
|
extern int sercon_main(int c, char **argv);
|
||||||
|
|
||||||
__EXPORT void board_on_reset(int status) {}
|
|
||||||
|
|
||||||
__EXPORT void stm32_boardinitialize(void)
|
|
||||||
{
|
|
||||||
/* configure USB interfaces */
|
|
||||||
stm32_usbinitialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
__EXPORT int board_app_initialize(uintptr_t arg)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void board_late_initialize(void)
|
void board_late_initialize(void)
|
||||||
{
|
{
|
||||||
sercon_main(0, NULL);
|
sercon_main(0, NULL);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ __EXPORT void board_peripheral_reset(int ms)
|
|||||||
__EXPORT void board_on_reset(int status)
|
__EXPORT void board_on_reset(int status)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < DIRECT_PWM_OUTPUT_CHANNELS; ++i) {
|
for (int i = 0; i < DIRECT_PWM_OUTPUT_CHANNELS; ++i) {
|
||||||
px4_arch_configgpio(PX4_MAKE_GPIO_INPUT(io_timer_channel_get_as_pwm_input(i)));
|
px4_arch_configgpio(io_timer_channel_get_gpio_output(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
@@ -208,6 +208,8 @@ stm32_boardinitialize(void)
|
|||||||
|
|
||||||
__EXPORT int board_app_initialize(uintptr_t arg)
|
__EXPORT int board_app_initialize(uintptr_t arg)
|
||||||
{
|
{
|
||||||
|
#if !defined(BOOTLOADER)
|
||||||
|
|
||||||
/* Power on Interfaces */
|
/* Power on Interfaces */
|
||||||
VDD_3V3_SD_CARD_EN(true);
|
VDD_3V3_SD_CARD_EN(true);
|
||||||
VDD_5V_PERIPH_EN(true);
|
VDD_5V_PERIPH_EN(true);
|
||||||
@@ -247,11 +249,11 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
|||||||
syslog(LOG_ERR, "[boot] DMA alloc FAILED\n");
|
syslog(LOG_ERR, "[boot] DMA alloc FAILED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SERIAL_HAVE_RXDMA)
|
# if defined(SERIAL_HAVE_RXDMA)
|
||||||
// set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event.
|
// set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event.
|
||||||
static struct hrt_call serial_dma_call;
|
static struct hrt_call serial_dma_call;
|
||||||
hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL);
|
hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL);
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* initial LED state */
|
/* initial LED state */
|
||||||
drv_led_start();
|
drv_led_start();
|
||||||
@@ -268,7 +270,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
|||||||
VDD_3V3_SD_CARD_EN(true);
|
VDD_3V3_SD_CARD_EN(true);
|
||||||
usleep(500 * 1000);
|
usleep(500 * 1000);
|
||||||
|
|
||||||
#ifdef CONFIG_MMCSD
|
# ifdef CONFIG_MMCSD
|
||||||
int ret = stm32_sdio_initialize();
|
int ret = stm32_sdio_initialize();
|
||||||
|
|
||||||
if (ret != OK) {
|
if (ret != OK) {
|
||||||
@@ -276,7 +278,9 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_MMCSD */
|
# endif /* CONFIG_MMCSD */
|
||||||
|
|
||||||
|
#endif /* !defined(BOOTLOADER) */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user