void stm32_boardinitialize(void) { /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spiinitialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) if (stm32_spiinitialize) { stm32_spiinitialize(); } #endif /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. */ #if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB) if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS up_ledinit(); #endif }
__END_DECLS /**************************************************************************** * Protected Functions ****************************************************************************/ /**************************************************************************** * Public Functions ****************************************************************************/ /************************************************************************************ * Name: stm32_boardinitialize * * Description: * All STM32 architectures must provide the following entry point. This entry point * is called early in the intitialization -- after all memory has been configured * and mapped but before any devices have been initialized. * ************************************************************************************/ __EXPORT void stm32_boardinitialize(void) { /* configure LEDs */ board_autoled_initialize(); stm32_usbinitialize(); }
void stm32_boardinitialize(void) { /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS board_autoled_initialize(); #endif #ifdef CONFIG_ARCH_BUTTONS board_button_initialize(); #endif /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function * stm32_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) stm32_spidev_initialize(); #endif /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. */ #if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB) stm32_usbinitialize(); #endif }
void stm32_boardinitialize(void) { /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spiinitialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) if (stm32_spiinitialize) { stm32_spiinitialize(); } #endif /* Initialize USB if the 1) USB device controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. Presumeably either CONFIG_USBDEV is also selected. */ #ifdef CONFIG_STM32_USB if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS up_ledinit(); #endif }
void stm32_boardinitialize(void) { /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also * selected. */ #ifdef CONFIG_STM32_OTGFS if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS board_autoled_initialize(); #endif /* Configure on-board BUTTONs if BUTTON support has been selected. */ #ifdef CONFIG_ARCH_BUTTONS board_button_initialize(); #endif }
void stm32_boardinitialize(void) { #ifdef CONFIG_ARCH_LEDS /* Configure on-board LEDs if LED support has been selected. */ board_autoled_initialize(); #endif #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || \ defined(CONFIG_STM32_SPI3) /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the * weak function stm32_spidev_initialize() has been brought into the link. */ stm32_spidev_initialize(); #endif #ifdef CONFIG_STM32_OTGFS /* Initialize USB if the OTG FS controller is in the configuration. * Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ stm32_usbinitialize(); #endif }
void stm32_boardinitialize(void) { #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spidev_initialize() has been brought into the link. */ if (stm32_spidev_initialize) { stm32_spidev_initialize(); } #endif #ifdef CONFIG_STM32_OTGFS /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also * selected. */ if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif #ifdef HAVE_NETMONITOR /* Configure board resources to support networking. */ if (stm32_netinitialize) { stm32_netinitialize(); } #endif #ifdef CONFIG_CANUTILS_UAVCAN (void)stm32_configgpio(GPIO_CAN1_RX); (void)stm32_configgpio(GPIO_CAN1_TX); # if CONFIG_UAVCAN_STM32_NUM_IFACES > 1 (void)stm32_configgpio(GPIO_CAN2_RX); (void)stm32_configgpio(GPIO_CAN2_TX); # endif #endif #ifdef CONFIG_ARCH_LEDS /* Configure on-board LEDs if LED support has been selected. */ board_autoled_initialize(); #endif }
__EXPORT void stm32_boardinitialize(void) { /* configure LEDs */ board_autoled_initialize(); /* configure ADC pins */ //todo:Revisit! ADC3 etc stm32_configgpio(GPIO_ADC1_IN2); /* BATT_VOLTAGE_SENS */ stm32_configgpio(GPIO_ADC1_IN3); /* BATT_CURRENT_SENS */ stm32_configgpio(GPIO_ADC1_IN4); /* VDD_5V_SENS */ stm32_configgpio(GPIO_ADC1_IN11); /* RSSI analog in */ /* configure power supply control/sense pins */ stm32_configgpio(GPIO_VDD_3V3_PERIPH_EN); stm32_configgpio(GPIO_VDD_BRICK_VALID); stm32_configgpio(GPIO_SBUS_INV); stm32_configgpio(GPIO_8266_GPIO0); // stm32_configgpio(GPIO_SPEKTRUM_PWR_EN); stm32_configgpio(GPIO_8266_PD); stm32_configgpio(GPIO_8266_RST); stm32_configgpio(GPIO_BTN_SAFETY); #ifdef GPIO_RC_OUT stm32_configgpio(GPIO_RC_OUT); /* Serial RC output pin */ stm32_gpiowrite(GPIO_RC_OUT, 1); /* set it high to pull RC input up */ #endif /* 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); /* configure SPI interfaces */ stm32_spiinitialize(); stm32_usbinitialize(); }
__EXPORT void stm32_boardinitialize(void) { /* configure LEDs */ board_autoled_initialize(); /* configure ADC pins */ px4_arch_configgpio(GPIO_ADC1_IN2); /* BATT_VOLTAGE_SENS */ px4_arch_configgpio(GPIO_ADC1_IN3); /* BATT_CURRENT_SENS */ px4_arch_configgpio(GPIO_ADC1_IN4); /* VDD_5V_SENS */ px4_arch_configgpio(GPIO_ADC1_IN13); /* FMU_AUX_ADC_1 */ px4_arch_configgpio(GPIO_ADC1_IN14); /* FMU_AUX_ADC_2 */ px4_arch_configgpio(GPIO_ADC1_IN15); /* PRESSURE_SENS */ /* configure power supply control/sense pins */ px4_arch_configgpio(GPIO_VDD_5V_PERIPH_EN); px4_arch_configgpio(GPIO_VDD_3V3_SENSORS_EN); px4_arch_configgpio(GPIO_VDD_BRICK_VALID); px4_arch_configgpio(GPIO_VDD_5V_PERIPH_OC); /* configure the GPIO pins to outputs and keep them low */ px4_arch_configgpio(GPIO_GPIO0_OUTPUT); px4_arch_configgpio(GPIO_GPIO1_OUTPUT); px4_arch_configgpio(GPIO_GPIO2_OUTPUT); px4_arch_configgpio(GPIO_GPIO3_OUTPUT); px4_arch_configgpio(GPIO_GPIO4_OUTPUT); px4_arch_configgpio(GPIO_GPIO5_OUTPUT); /* configure SPI interfaces */ stm32_spiinitialize(); /* configure USB interface */ stm32_usbinitialize(); }
void stm32_boardinitialize(void) { /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spiinitialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) if (stm32_spiinitialize) { stm32_spiinitialize(); } #endif /* If the FSMC is enabled, then enable SRAM access */ #ifdef CONFIG_STM32_FSMC stm32_selectsram(); #endif /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * the weak function stm32_usbinitialize() has been brought into the build. * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ #ifdef CONFIG_STM32_OTGFS if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS stm32_autoled_initialize(); #endif }
void stm32_boardinitialize(void) { /* First reset the VS1053 since it tends to produce noise out of power on reset */ #ifdef CONFIG_AUDIO_VS1053 (void)stm32_configgpio(GPIO_VS1053_RST); #endif /* Configure GPIOs for controlling the LCD */ #if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A) stm32_lcdinitialize(); #endif /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) if (stm32_spidev_initialize) { stm32_spidev_initialize(); } #endif /* Initialize USB if the 1) OTG FS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also * selected. */ #ifdef CONFIG_STM32_OTGFS if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif }
__EXPORT void stm32_boardinitialize(void) { board_on_reset(-1); /* Reset PWM first thing */ /* configure LEDs */ board_autoled_initialize(); /* configure pins */ const uint32_t gpio[] = PX4_GPIO_INIT_LIST; board_gpio_init(gpio, arraySize(gpio)); /* configure SPI interfaces */ stm32_spiinitialize(); /* configure USB interfaces */ stm32_usbinitialize(); }
void stm32_boardinitialize(void) { /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * stm32_spiinitialize() has been brought into the link. */ #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) ||\ defined(CONFIG_STM32_SPI4) || defined(CONFIG_STM32_SPI5) if (stm32_spiinitialize) { stm32_spiinitialize(); } #endif /* Initialize USB if the 1) OTG HS controller is in the configuration and 2) * disabled, and 3) the weak function stm32_usbinitialize() has been brought * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also * selected. */ #ifdef CONFIG_STM32_OTGHS if (stm32_usbinitialize) { stm32_usbinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS board_led_initialize(); #endif #ifdef CONFIG_STM32_FSMC stm32_enablefsmc(); #endif }
__EXPORT int nsh_archinitialize(void) { int result; message("\n"); /* configure always-on ADC pins */ stm32_configgpio(GPIO_ADC1_IN10); //VBAT stm32_configgpio(GPIO_ADC1_IN11); //IBAT stm32_configgpio(GPIO_ADC1_IN14); //SONAR_IN_1 stm32_configgpio(GPIO_ADC1_IN15); //SONAR_IN_2 stm32_configgpio(GPIO_USB_PRESENT); stm32_configgpio(GPIO_SHUTDOWN); stm32_configgpio(GPIO_SHUTDOWN_INT); // stm32_configgpio(GPIO_AUX_OUT1); // stm32_configgpio(GPIO_AUX_OUT2); // stm32_configgpio(GPIO_AUX_OUT3); // stm32_configgpio(GPIO_AUX_IN1); // stm32_configgpio(GPIO_AUX_IN2); stm32_configgpio(GPIO_AUX_IO1); stm32_configgpio(GPIO_AUX_IO2); stm32_configgpio(GPIO_AUX_IO3); stm32_configgpio(GPIO_AUX_IO4); stm32_configgpio(GPIO_AUX_IO5); stm32_configgpio(GPIO_AUX_IO6); /* configure the high-resolution time/callout interface */ hrt_init(); /* configure CPU load estimation */ #ifdef CONFIG_SCHED_INSTRUMENTATION cpuload_initialize_once(); #endif /* initial LED state */ drv_led_start(); led_off(LED_AMBER); led_off(LED_BLUE); led_off(LED_GREEN); message("[boot] Initializing USB detect\n"); stm32_usbinitialize(); /* Configure SPI-based devices */ message("[boot] Initializing SPI port 1\n"); spi1 = up_spiinitialize(1); if (!spi1) { message("[boot] FAILED to initialize SPI port 1\r\n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); SPI_SELECT(spi1, GPIO_SPI_CS_DATAFLASH, false); SPI_SELECT(spi1, GPIO_SPI_CS_EEPROM, false); SPI_SELECT(spi1, GPIO_SPI_CS_DF_EXT1, false); SPI_SELECT(spi1, GPIO_SPI_CS_DF_EXT2, false); SPI_SELECT(spi1, GPIO_SPI_CS_DF_EXT3, false); SPI_SELECT(spi1, GPIO_SPI_CS_DF_EXT4, false); SPI_SELECT(spi1, GPIO_SPI_CS_DF_EXT5, false); SPI_SELECT(spi1, GPIO_SPI_CS_MS5611, false); up_udelay(20); message("[boot] Successfully initialized SPI port 1\r\n"); message("[boot] Initializing SPI port 2\n"); spi2 = up_spiinitialize(2); if (!spi2) { message("[boot] FAILED to initialize SPI port 2\r\n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI2 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi2, 10000000); SPI_SETBITS(spi2, 8); SPI_SETMODE(spi2, SPIDEV_MODE3); SPI_SELECT(spi2, GPIO_SPI_CS_MPU6000, false); message("[boot] Successfully initialized SPI port 2\n"); /* Get the SPI port for the microSD slot */ message("[boot] Initializing SPI port 3\n"); spi3 = up_spiinitialize(3); if (!spi3) { message("[boot] FAILED to initialize SPI port 3\n"); led_on(LED_AMBER); return -ENODEV; } message("[boot] Successfully initialized SPI port 3\n"); /* Now bind the SPI interface to the MMCSD driver */ result = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi3); if (result != OK) { message("[boot] FAILED to bind SPI port 3 to the MMCSD driver\n"); led_on(LED_AMBER); return -ENODEV; } message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n"); return OK; }
__EXPORT int nsh_archinitialize(void) { int result; message("\n"); /* configure always-on ADC pins */ #if APM_BUILD_TYPE(APM_BUILD_ArduPlane) stm32_configgpio(GPIO_GPIO0_INPUT); stm32_configgpio(GPIO_ADC1_IN0); #endif stm32_configgpio(GPIO_ADC1_IN10); stm32_configgpio(GPIO_ADC1_IN11); /* configure the high-resolution time/callout interface */ hrt_init(); /* configure CPU load estimation */ #ifdef CONFIG_SCHED_INSTRUMENTATION cpuload_initialize_once(); #endif /* initial BUZZER state */ drv_buzzer_start(); buzzer_off(BUZZER_EXT); /* initial LED state */ drv_led_start(); led_off(LED_AMBER); led_off(LED_BLUE); led_off(LED_GREEN); led_off(LED_EXT1); led_off(LED_EXT2); led_off(LED_EXT3); message("[boot] Initializing USB detect\n"); stm32_usbinitialize(); /* Configure SPI-based devices */ message("[boot] Initializing SPI port 1\n"); spi1 = up_spiinitialize(1); if (!spi1) { message("[boot] FAILED to initialize SPI port 1\r\n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); SPI_SELECT(spi1, SPIDEV_FLASH, false); SPI_SELECT(spi1, SPIDEV_MS5611, false); up_udelay(20); message("[boot] Successfully initialized SPI port 1\r\n"); message("[boot] Initializing SPI port 2\n"); spi2 = up_spiinitialize(2); if (!spi2) { message("[boot] FAILED to initialize SPI port 2\r\n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI2 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi2, 10000000); SPI_SETBITS(spi2, 8); SPI_SETMODE(spi2, SPIDEV_MODE3); SPI_SELECT(spi2, SPIDEV_MPU6000, false); message("[boot] Successfully initialized SPI port 2\n"); #ifndef MPU6000_EXTERNAL /* Get the SPI port for the microSD slot */ message("[boot] Initializing SPI port 3\n"); spi3 = up_spiinitialize(3); if (!spi3) { message("[boot] FAILED to initialize SPI port 3\n"); led_on(LED_AMBER); return -ENODEV; } message("[boot] Successfully initialized SPI port 3\n"); /* Now bind the SPI interface to the MMCSD driver */ result = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi3); if (result != OK) { message("[boot] FAILED to bind SPI port 3 to the MMCSD driver\n"); led_on(LED_AMBER); return -ENODEV; } message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n"); #else message("[boot] Initializing SPI port 3\n"); spi3 = up_spiinitialize(3); if (!spi3) { message("[boot] FAILED to initialize SPI port 3\n"); led_on(LED_AMBER); return -ENODEV; } /* Default SPI3 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi3, 10000000); SPI_SETBITS(spi3, 8); SPI_SETMODE(spi3, SPIDEV_MODE3); SPI_SELECT(spi3, SPIDEV_EXP_MPU6000, false); message("[boot] Successfully initialized SPI port 3\n"); #endif return OK; }