diff --git a/boards.txt b/boards.txt index c2600249f9..7c4bdb1a9f 100644 --- a/boards.txt +++ b/boards.txt @@ -1108,7 +1108,6 @@ RAK.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg Genericflight.name=Generic flight controllers - Genericflight.build.vid=0x0483 Genericflight.build.core=arduino Genericflight.build.board=Genericflight @@ -1117,8 +1116,6 @@ Genericflight.build.series=STM32F1xx Genericflight.build.cmsis_lib_gcc=arm_cortexM3l_math Genericflight.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags} - - # AfroFlight Rev5 Genericflight.menu.pnum.AFROFLIGHT_F103CB=Afro Flight Rev5 Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_size=131072 @@ -1128,10 +1125,7 @@ Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.series=STM32F1xx Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.product_line=STM32F103xB Genericflight.menu.pnum.AFROFLIGHT_F103CB.build.variant=AFROFLIGHT_F103CB - - # Upload menu - Genericflight.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD) Genericflight.menu.upload_method.swdMethod.upload.protocol=0 Genericflight.menu.upload_method.swdMethod.upload.options=-g diff --git a/variants/AFROFLIGHT_F103CB/PeripheralPins.c b/variants/AFROFLIGHT_F103CB/PeripheralPins.c index 7d3c6f140b..2d554ce6c7 100644 --- a/variants/AFROFLIGHT_F103CB/PeripheralPins.c +++ b/variants/AFROFLIGHT_F103CB/PeripheralPins.c @@ -73,9 +73,7 @@ WEAK const PinMap PinMap_ADC[] = { WEAK const PinMap PinMap_I2C_SDA[] = { {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)}, {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -84,9 +82,7 @@ WEAK const PinMap PinMap_I2C_SDA[] = { WEAK const PinMap PinMap_I2C_SCL[] = { {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)}, {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_I2C1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -126,7 +122,6 @@ WEAK const PinMap PinMap_PWM[] = { {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM2_ENABLE, 2, 0)}, // TIM2_CH2 {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 1, 0)}, // TIM3_CH1 {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_TIM3_PARTIAL, 2, 0)}, // TIM3_CH2 -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 1, 0)}, // TIM4_CH1 {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 2, 0)}, // TIM4_CH2 {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE, 3, 0)}, // TIM4_CH3 @@ -150,7 +145,6 @@ WEAK const PinMap PinMap_UART_TX[] = { {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART1_ENABLE)}, {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -160,9 +154,7 @@ WEAK const PinMap PinMap_UART_RX[] = { {PA_3, USART2, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)}, {PA_10, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)}, {PB_7, USART1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_USART1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_11, USART3, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -171,10 +163,8 @@ WEAK const PinMap PinMap_UART_RX[] = { WEAK const PinMap PinMap_UART_RTS[] = { {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, // {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)}, -#endif {NC, NP, 0} }; #endif @@ -183,10 +173,8 @@ WEAK const PinMap PinMap_UART_RTS[] = { WEAK const PinMap PinMap_UART_CTS[] = { {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, // {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_USART3_PARTIAL)}, -#endif {NC, NP, 0} }; #endif @@ -197,9 +185,7 @@ WEAK const PinMap PinMap_UART_CTS[] = { WEAK const PinMap PinMap_SPI_MOSI[] = { {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -208,9 +194,7 @@ WEAK const PinMap PinMap_SPI_MOSI[] = { WEAK const PinMap PinMap_SPI_MISO[] = { {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -219,9 +203,7 @@ WEAK const PinMap PinMap_SPI_MISO[] = { WEAK const PinMap PinMap_SPI_SCLK[] = { {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif @@ -230,9 +212,7 @@ WEAK const PinMap PinMap_SPI_SCLK[] = { WEAK const PinMap PinMap_SPI_SSEL[] = { {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_SPI1_ENABLE)}, -#ifndef ARDUINO_BLUEPILL_F103C6 {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, AFIO_NONE)}, -#endif {NC, NP, 0} }; #endif diff --git a/variants/AFROFLIGHT_F103CB/variant.cpp b/variants/AFROFLIGHT_F103CB/variant.cpp index 30abde0fed..c5ccb9e3fb 100644 --- a/variants/AFROFLIGHT_F103CB/variant.cpp +++ b/variants/AFROFLIGHT_F103CB/variant.cpp @@ -35,8 +35,6 @@ extern "C" { // Pin number const PinName digitalPin[] = { - /* USB connector on the top, MCU side */ - /* Left Side */ PB_9, //D0 PB_8, //D1 PB_7, //D2 @@ -45,17 +43,16 @@ const PinName digitalPin[] = { PB_4, //D5 PB_3, //D6 PA_15, //D7 - PA_12, //D8 - USB DP - PA_11, //D9 - USB DM + PA_12, //D8 + PA_11, //D9 PA_10, //D10 PA_9, //D11 PA_8, //D12 PB_15, //D13 PB_14, //D14 PB_13, //D15 - PB_12, //D16 - LED Blackpill - /* Right side */ - PC_13, //D17 - LED Bluepill + PB_12, //D16 + PC_13, //D17 PC_14, //D18 PC_15, //D19 PA_0, //D20/A0 @@ -87,24 +84,12 @@ extern "C" { /** * @brief System Clock Configuration - * The system Clock is configured as follow : - * System Clock source = PLL (HSE) - * SYSCLK(Hz) = 72000000 - * HCLK(Hz) = 72000000 - * AHB Prescaler = 1 - * APB1 Prescaler = 2 - * APB2 Prescaler = 1 - * PLL_Source = HSE - * PLL_Mul = 9 - * Flash Latency(WS) = 2 - * ADC Prescaler = 6 - * USB Prescaler = 1.5 * @param None * @retval None */ WEAK void SystemClock_Config(void) { -//Board has 12mhz xtal, iám currenlty using HSI internal xtal , i've not figured settings for external 12mhz + // Board has external 12MHz Xtal, currenlty using HSI internal Xtal RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit; diff --git a/variants/AFROFLIGHT_F103CB/variant.h b/variants/AFROFLIGHT_F103CB/variant.h index 4eb69af993..92cd63bc0e 100644 --- a/variants/AFROFLIGHT_F103CB/variant.h +++ b/variants/AFROFLIGHT_F103CB/variant.h @@ -38,27 +38,24 @@ extern "C" { * Pins *----------------------------------------------------------------------------*/ -// Bluepill USB connector on the top, MCU side - Blackpill USB connector on bottom, MCU Side (pins are reversed vertically for Arduino Ananlog pin correct sequence. -// Left Side #define PB9 0 #define PB8 1 #define PB7 2 #define PB6 3 #define PB5 4 -#define PB4 5 -#define PB3 6 +#define PB4 5 // LED0 +#define PB3 6 // LED1 #define PA15 7 -#define PA12 8 // USB DP -#define PA11 9 // USB DM +#define PA12 8 +#define PA11 9 #define PA10 10 #define PA9 11 #define PA8 12 #define PB15 13 #define PB14 14 #define PB13 15 -#define PB12 16 // LED Blackpill -// Right side -#define PC13 17 // LED Bluepill +#define PB12 16 +#define PC13 17 #define PC14 18 #define PC15 19 #define PA0 20 // A0 @@ -85,14 +82,10 @@ extern "C" { #define NUM_ANALOG_FIRST 20 // On-board LED pin number -#ifdef ARDUINO_BLUEPILL_F103C8 -#define LED_BUILTIN PC13 -#else -#define LED_BUILTIN PB4 -#endif -#define LED_GREEN PB3 -#define LED_RED LED_BUILTIN +#define LED0 PB4 +#define LED1 PB3 +#define LED_BUILTIN LED0 // SPI Definitions #define PIN_SPI_SS PA4 @@ -101,19 +94,13 @@ extern "C" { #define PIN_SPI_SCK PA5 // I2C Definitions -//#define PIN_WIRE_SDA PB7 -//#define PIN_WIRE_SCL PB6 //On afroflight Rev 5 it's on i2c port 2 that MPU6050 is connected too -#define PIN_WIRE_SDA PB11 -#define PIN_WIRE_SCL PB10 - +#define PIN_WIRE_SDA PB11 +#define PIN_WIRE_SCL PB10 // Timer Definitions -// Do not use timer used by PWM pins when possible. See PinMap_PWM. #define TIMER_TONE TIM3 - -// Do not use basic timer: OC is required -#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work +#define TIMER_SERVO TIM2 // UART Definitions #define SERIAL_UART_INSTANCE 1 @@ -122,38 +109,38 @@ extern "C" { #define PIN_SERIAL_RX PA10 #define PIN_SERIAL_TX PA9 -#define MPU_I2C_SDA PB11; -#define MPU_I2C_SCL PB10; -#define MPU_ADDR 0x68; -#define MPU_INT PB13; +#define MPU_I2C_SDA PB11 +#define MPU_I2C_SCL PB10 +#define MPU_ADDR 0x68 +#define MPU_INT PB13 /* - * RC_CH1 T2C1 PA0 - * RC_CH2 T2C2 PA1 - * RC_CH3 T2C3/UA2_TX PA2 - * RC_CH4 T2C4/UA2_RX PA3 - * RC_CH5 T3C1 PA6 - * RC_CH6 T3C2 PA7 - * RC_CH7 T3C3 PB0 - * RC_CH8 T3C4 PB1 + * RC_CH1 T2C1 PA0 + * RC_CH2 T2C2 PA1 + * RC_CH3 T2C3/UA2_TX PA2 + * RC_CH4 T2C4/UA2_RX PA3 + * RC_CH5 T3C1 PA6 + * RC_CH6 T3C2 PA7 + * RC_CH7 T3C3 PB0 + * RC_CH8 T3C4 PB1 * - * PWM1 T1C1 PA8 - * PMW2 T1C4 PA11 - * PMW3 T4C1 PB6 - * PMW4 T4C2 PB7 - * PMW5 T4C3 PB8 - * PMW6 T4C4 PB9 - * SONAR_INT PA15 - * GPIO_BOTTOM PB5 - * TELEM_OUT PA13 // Warning, SWD access is lost when using this pin, bootloader via uart is required after + * PWM1 T1C1 PA8 + * PMW2 T1C4 PA11 + * PMW3 T4C1 PB6 + * PMW4 T4C2 PB7 + * PMW5 T4C3 PB8 + * PMW6 T4C4 PB9 + * SONAR_INT PA15 + * GPIO_BOTTOM PB5 + * TELEM_OUT PA13 // Warning, SWD access is lost when using this pin, bootloader via uart is required after * - * BAT_ADC PA4 // Connected to 6 pin header Battery voltage in via resistor divider - * ACC_INT PA5 //Connected to Intterupt pin of MMA84520 accelerometer I2C + * BAT_ADC PA4 // Connected to 6 pin header Battery voltage in via resistor divider + * ACC_INT PA5 // Connected to Intterupt pin of MMA84520 accelerometer I2C * - * MAG_DRD PB12; //Connected to HMC5883L compass I2C - * BEEP PA12; //Connected to Beep out transistor on 6 pin header + * MAG_DRD PB12 //Connected to HMC5883L compass I2C + * BEEP PA12 //Connected to Beep out transistor on 6 pin header * */ - + #ifdef __cplusplus } // extern "C" #endif