From c86d9c4f437ddfebfaadbe8dc02c9b8f523cacec Mon Sep 17 00:00:00 2001 From: EmanuelFeru Date: Thu, 10 Dec 2020 19:35:13 +0100 Subject: [PATCH] Improvements and clean-up - clean-up printfs - removed consoleLog function with respective files - removed Delay when using printf - renamed speedL, speedR to cmdL, cmdR - corrected Arduino baud rate - updated FLASH write pointer cast int16_t to uint16_t --- Arduino/hoverserial/hoverserial.ino | 122 +++--- Inc/config.h | 38 +- MDK-ARM/mainboard-hack.uvoptx | 217 +++++++++-- MDK-ARM/mainboard-hack.uvprojx | 585 ++++++++++++++++++++++++++-- Makefile | 1 - Src/main.c | 66 ++-- Src/util.c | 105 +++-- {Src => docs/recycle}/comms.c | 25 -- {Inc => docs/recycle}/comms.h | 0 platformio.ini | 20 +- 10 files changed, 909 insertions(+), 270 deletions(-) rename {Src => docs/recycle}/comms.c (77%) rename {Inc => docs/recycle}/comms.h (100%) diff --git a/Arduino/hoverserial/hoverserial.ino b/Arduino/hoverserial/hoverserial.ino index 3897bc4..e219584 100644 --- a/Arduino/hoverserial/hoverserial.ino +++ b/Arduino/hoverserial/hoverserial.ino @@ -23,15 +23,15 @@ // ******************************************************************* // ########################## DEFINES ########################## -#define HOVER_SERIAL_BAUD 38400 // [-] Baud rate for HoverSerial (used to communicate with the hoverboard) +#define HOVER_SERIAL_BAUD 115200 // [-] Baud rate for HoverSerial (used to communicate with the hoverboard) #define SERIAL_BAUD 115200 // [-] Baud rate for built-in Serial (used for the Serial Monitor) #define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication #define TIME_SEND 100 // [ms] Sending time interval #define SPEED_MAX_TEST 300 // [-] Maximum speed for testing -//#define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable) +// #define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable) #include -SoftwareSerial HoverSerial(2,3); // RX, TX +SoftwareSerial HoverSerial(2,3); // RX, TX // Global variables uint8_t idx = 0; // Index for new data pointer @@ -41,7 +41,7 @@ byte incomingByte; byte incomingBytePrev; typedef struct{ - uint16_t start; + uint16_t start; int16_t steer; int16_t speed; uint16_t checksum; @@ -50,12 +50,12 @@ SerialCommand Command; typedef struct{ uint16_t start; - int16_t cmd1; - int16_t cmd2; - int16_t speedR_meas; - int16_t speedL_meas; - int16_t batVoltage; - int16_t boardTemp; + int16_t cmd1; + int16_t cmd2; + int16_t speedR_meas; + int16_t speedL_meas; + int16_t batVoltage; + int16_t boardTemp; uint16_t cmdLed; uint16_t checksum; } SerialFeedback; @@ -67,7 +67,7 @@ void setup() { Serial.begin(SERIAL_BAUD); Serial.println("Hoverboard Serial v1.0"); - + HoverSerial.begin(HOVER_SERIAL_BAUD); pinMode(LED_BUILTIN, OUTPUT); } @@ -88,59 +88,59 @@ void Send(int16_t uSteer, int16_t uSpeed) // ########################## RECEIVE ########################## void Receive() { - // Check for new data availability in the Serial buffer - if (HoverSerial.available()) { - incomingByte = HoverSerial.read(); // Read the incoming byte - bufStartFrame = ((uint16_t)(incomingByte) << 8) | incomingBytePrev; // Construct the start frame - } - else { - return; - } + // Check for new data availability in the Serial buffer + if (HoverSerial.available()) { + incomingByte = HoverSerial.read(); // Read the incoming byte + bufStartFrame = ((uint16_t)(incomingByte) << 8) | incomingBytePrev; // Construct the start frame + } + else { + return; + } // If DEBUG_RX is defined print all incoming bytes #ifdef DEBUG_RX - Serial.print(incomingByte); - return; - #endif - - // Copy received data - if (bufStartFrame == START_FRAME) { // Initialize if new data is detected - p = (byte *)&NewFeedback; - *p++ = incomingBytePrev; - *p++ = incomingByte; - idx = 2; - } else if (idx >= 2 && idx < sizeof(SerialFeedback)) { // Save the new received data - *p++ = incomingByte; - idx++; - } - - // Check if we reached the end of the package - if (idx == sizeof(SerialFeedback)) { - uint16_t checksum; - checksum = (uint16_t)(NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback.cmd2 ^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas - ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp ^ NewFeedback.cmdLed); - - // Check validity of the new data - if (NewFeedback.start == START_FRAME && checksum == NewFeedback.checksum) { - // Copy the new data - memcpy(&Feedback, &NewFeedback, sizeof(SerialFeedback)); - - // Print data to built-in Serial - Serial.print("1: "); Serial.print(Feedback.cmd1); - Serial.print(" 2: "); Serial.print(Feedback.cmd2); - Serial.print(" 3: "); Serial.print(Feedback.speedR_meas); - Serial.print(" 4: "); Serial.print(Feedback.speedL_meas); - Serial.print(" 5: "); Serial.print(Feedback.batVoltage); - Serial.print(" 6: "); Serial.print(Feedback.boardTemp); - Serial.print(" 7: "); Serial.println(Feedback.cmdLed); - } else { - Serial.println("Non-valid data skipped"); - } - idx = 0; // Reset the index (it prevents to enter in this if condition in the next cycle) - } - - // Update previous states - incomingBytePrev = incomingByte; + Serial.print(incomingByte); + return; + #endif + + // Copy received data + if (bufStartFrame == START_FRAME) { // Initialize if new data is detected + p = (byte *)&NewFeedback; + *p++ = incomingBytePrev; + *p++ = incomingByte; + idx = 2; + } else if (idx >= 2 && idx < sizeof(SerialFeedback)) { // Save the new received data + *p++ = incomingByte; + idx++; + } + + // Check if we reached the end of the package + if (idx == sizeof(SerialFeedback)) { + uint16_t checksum; + checksum = (uint16_t)(NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback.cmd2 ^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas + ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp ^ NewFeedback.cmdLed); + + // Check validity of the new data + if (NewFeedback.start == START_FRAME && checksum == NewFeedback.checksum) { + // Copy the new data + memcpy(&Feedback, &NewFeedback, sizeof(SerialFeedback)); + + // Print data to built-in Serial + Serial.print("1: "); Serial.print(Feedback.cmd1); + Serial.print(" 2: "); Serial.print(Feedback.cmd2); + Serial.print(" 3: "); Serial.print(Feedback.speedR_meas); + Serial.print(" 4: "); Serial.print(Feedback.speedL_meas); + Serial.print(" 5: "); Serial.print(Feedback.batVoltage); + Serial.print(" 6: "); Serial.print(Feedback.boardTemp); + Serial.print(" 7: "); Serial.println(Feedback.cmdLed); + } else { + Serial.println("Non-valid data skipped"); + } + idx = 0; // Reset the index (it prevents to enter in this if condition in the next cycle) + } + + // Update previous states + incomingBytePrev = incomingByte; } // ########################## LOOP ########################## diff --git a/Inc/config.h b/Inc/config.h index 5d064da..a55fd4b 100644 --- a/Inc/config.h +++ b/Inc/config.h @@ -124,7 +124,7 @@ - button1 and button2: digital input values. 0 or 1 - adc_buffer.l_tx2 and adc_buffer.l_rx2: unfiltered ADC values (you do not need them). 0 to 4095 Outputs: - - speedR and speedL: normal driving INPUT_MIN to INPUT_MAX + - cmdL and cmdR: normal driving INPUT_MIN to INPUT_MAX */ #define COM_CTRL 0 // [-] Commutation Control Type #define SIN_CTRL 1 // [-] Sinusoidal Control Type @@ -205,38 +205,30 @@ * Be careful not to use the red wire of the cable. 15v will destroy everything. * If you are using VARIANT_NUNCHUK, disable it temporarily. * enable DEBUG_SERIAL_USART3 or DEBUG_SERIAL_USART2 - * and DEBUG_SERIAL_ASCII use asearial terminal. * * * DEBUG_SERIAL_ASCII output is: - * // "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n" + * // "in1:345 in2:1337 cmdL:0 cmdR:0 BatADC:0 BatV:0 TempADC:0 Temp:0\r\n" * - * 1: (int16_t)input1); raw input1: ADC1, UART, PWM, PPM, iBUS - * 2: (int16_t)input2); raw input2: ADC2, UART, PWM, PPM, iBUS - * 3: (int16_t)speedR); output command: [-1000, 1000] - * 4: (int16_t)speedL); output command: [-1000, 1000] - * 5: (int16_t)adc_buffer.batt1); Battery adc-value measured by mainboard - * 6: (int16_t)(batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC)); Battery calibrated voltage multiplied by 100 for verifying battery voltage calibration - * 7: (int16_t)board_temp_adcFilt); for board temperature calibration - * 8: (int16_t)board_temp_deg_c); Temperature in celcius for verifying board temperature calibration + * in1: (int16_t)input1); raw input1: ADC1, UART, PWM, PPM, iBUS + * in2: (int16_t)input2); raw input2: ADC2, UART, PWM, PPM, iBUS + * cmdL: (int16_t)speedL); output command: [-1000, 1000] + * cmdR: (int16_t)speedR); output command: [-1000, 1000] + * BatADC: (int16_t)adc_buffer.batt1); Battery adc-value measured by mainboard + * BatV: (int16_t)(batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC)); Battery calibrated voltage multiplied by 100 for verifying battery voltage calibration + * TempADC: (int16_t)board_temp_adcFilt); for board temperature calibration + * Temp: (int16_t)board_temp_deg_c); Temperature in celcius for verifying board temperature calibration * */ // #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! -#if defined(VARIANT_ADC) - #define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuk or lcd) is used! -#endif - -#ifndef VARIANT_TRANSPOTTER - //#define DEBUG_SERIAL_SERVOTERM - #define DEBUG_SERIAL_ASCII -#endif +// #define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuk or lcd) is used! // ########################### END OF DEBUG SERIAL ############################ // ############################### DEBUG LCD ############################### -//#define DEBUG_I2C_LCD // standard 16x2 or larger text-lcd via i2c-converter on right sensor board cable +// #define DEBUG_I2C_LCD // standard 16x2 or larger text-lcd via i2c-converter on right sensor board cable // ########################### END OF DEBUG LCD ############################ @@ -276,6 +268,8 @@ #define INPUT2_MID 0 // mid ADC2-value while poti at mid-position (INPUT2_MIN - INPUT2_MAX) #define INPUT2_MAX 4095 // max ADC2-value while poti at max-position (0 - 4095) #define INPUT2_DEADBAND 0 // How much of the center position is considered 'center' (100 = values -100 to 100 are considered 0) + + #define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuk or lcd) is used! // #define SUPPORT_BUTTONS_LEFT // use left sensor board cable for button inputs. Disable DEBUG_SERIAL_USART2! // #define SUPPORT_BUTTONS_RIGHT // use right sensor board cable for button inputs. Disable DEBUG_SERIAL_USART3! #endif @@ -293,13 +287,13 @@ #define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuk or lcd) is used! For Arduino control check the hoverSerial.ino #define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuk or lcd) is used! // Min / Max values of each channel (use DEBUG to determine these values) - #define INPUT1_TYPE 1 // 0:Disabled, 1:Normal Pot, 2:Middle Resting Pot, 3:Auto-detect + #define INPUT1_TYPE 3 // 0:Disabled, 1:Normal Pot, 2:Middle Resting Pot, 3:Auto-detect #define INPUT1_MIN -1000 // (-1000 - 0) #define INPUT1_MID 0 #define INPUT1_MAX 1000 // (0 - 1000) #define INPUT1_DEADBAND 0 // How much of the center position is considered 'center' (100 = values -100 to 100 are considered 0) - #define INPUT2_TYPE 1 // 0:Disabled, 1:Normal Pot, 2:Middle Resting Pot, 3:Auto-detect + #define INPUT2_TYPE 3 // 0:Disabled, 1:Normal Pot, 2:Middle Resting Pot, 3:Auto-detect #define INPUT2_MIN -1000 // (-1000 - 0) #define INPUT2_MID 0 #define INPUT2_MAX 1000 // (0 - 1000) diff --git a/MDK-ARM/mainboard-hack.uvoptx b/MDK-ARM/mainboard-hack.uvoptx index 93cd70d..7f8ed9c 100644 --- a/MDK-ARM/mainboard-hack.uvoptx +++ b/MDK-ARM/mainboard-hack.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -1398,6 +1398,159 @@ + + VARIANT_SKATEBOARD + 0x4 + ARM-ADS + + 8000000 + + 1 + 0 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Listing\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 5 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ST-LINKIII-KEIL_SWO + -U -O206 -S0 -C0 -A0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM)) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 10000000 + + + + Startup 1 @@ -1467,18 +1620,6 @@ 0 0 0 - ..\Src\comms.c - comms.c - 0 - 0 - - - 2 - 6 - 1 - 0 - 0 - 0 ..\Src\control.c control.c 0 @@ -1486,7 +1627,7 @@ 2 - 7 + 6 1 0 0 @@ -1498,7 +1639,7 @@ 2 - 8 + 7 1 0 0 @@ -1510,7 +1651,7 @@ 2 - 9 + 8 1 0 0 @@ -1522,7 +1663,7 @@ 2 - 10 + 9 1 0 0 @@ -1534,7 +1675,7 @@ 2 - 11 + 10 1 0 0 @@ -1546,7 +1687,7 @@ 2 - 12 + 11 1 0 0 @@ -1558,7 +1699,7 @@ 2 - 13 + 12 1 0 0 @@ -1570,7 +1711,7 @@ 2 - 14 + 13 5 0 0 @@ -1590,7 +1731,7 @@ 0 3 - 15 + 14 1 0 0 @@ -1602,7 +1743,7 @@ 3 - 16 + 15 1 0 0 @@ -1614,7 +1755,7 @@ 3 - 17 + 16 1 0 0 @@ -1626,7 +1767,7 @@ 3 - 18 + 17 1 0 0 @@ -1638,7 +1779,7 @@ 3 - 19 + 18 1 0 0 @@ -1650,7 +1791,7 @@ 3 - 20 + 19 1 0 0 @@ -1662,7 +1803,7 @@ 3 - 21 + 20 1 0 0 @@ -1674,7 +1815,7 @@ 3 - 22 + 21 1 0 0 @@ -1686,7 +1827,7 @@ 3 - 23 + 22 1 0 0 @@ -1698,7 +1839,7 @@ 3 - 24 + 23 1 0 0 @@ -1710,7 +1851,7 @@ 3 - 25 + 24 1 0 0 @@ -1722,7 +1863,7 @@ 3 - 26 + 25 1 0 0 @@ -1734,7 +1875,7 @@ 3 - 27 + 26 1 0 0 @@ -1746,7 +1887,7 @@ 3 - 28 + 27 1 0 0 @@ -1758,7 +1899,7 @@ 3 - 29 + 28 1 0 0 @@ -1770,7 +1911,7 @@ 3 - 30 + 29 1 0 0 @@ -1790,7 +1931,7 @@ 0 4 - 31 + 30 1 0 0 diff --git a/MDK-ARM/mainboard-hack.uvprojx b/MDK-ARM/mainboard-hack.uvprojx index 4fcbab9..58bf2f9 100644 --- a/MDK-ARM/mainboard-hack.uvprojx +++ b/MDK-ARM/mainboard-hack.uvprojx @@ -404,11 +404,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -954,11 +949,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -1572,11 +1562,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -2190,11 +2175,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -2808,11 +2788,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -3426,11 +3401,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -4044,11 +4014,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -4662,11 +4627,6 @@ 1 ..\Src\BLDC_controller_data.c - - comms.c - 1 - ..\Src\comms.c - control.c 1 @@ -5213,9 +5173,549 @@ ..\Src\BLDC_controller_data.c - comms.c + control.c 1 - ..\Src\comms.c + ..\Src\control.c + + + eeprom.c + 1 + ..\Src\eeprom.c + + + hd44780.c + 1 + ..\Src\hd44780.c + + + main.c + 1 + ..\Src\main.c + + + pcf8574.c + 1 + ..\Src\pcf8574.c + + + setup.c + 1 + ..\Src\setup.c + + + stm32f1xx_it.c + 1 + ..\Src\stm32f1xx_it.c + + + util.c + 1 + ..\Src\util.c + + + config.h + 5 + ..\Inc\config.h + + + + + HAL_Driver + + + stm32f1xx_hal.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c + + + stm32f1xx_hal_adc.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc.c + + + stm32f1xx_hal_adc_ex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_adc_ex.c + + + stm32f1xx_hal_cortex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c + + + stm32f1xx_hal_dma.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c + + + stm32f1xx_hal_flash.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c + + + stm32f1xx_hal_flash_ex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c + + + stm32f1xx_hal_gpio.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c + + + stm32f1xx_hal_gpio_ex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c + + + stm32f1xx_hal_i2c.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_i2c.c + + + stm32f1xx_hal_pwr.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c + + + stm32f1xx_hal_rcc.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c + + + stm32f1xx_hal_rcc_ex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c + + + stm32f1xx_hal_tim.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c + + + stm32f1xx_hal_tim_ex.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c + + + stm32f1xx_hal_uart.c + 1 + ..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c + + + + + CMSIS + + + system_stm32f1xx.c + 1 + ../Src/system_stm32f1xx.c + + + + + ::CMSIS + + + + + VARIANT_SKATEBOARD + 0x4 + ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC + + + STM32F103RC + STMicroelectronics + Keil.STM32F1xx_DFP.2.3.0 + http://www.keil.com/pack/ + IRAM(0x20000000-0x2000BFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3") + + + + + + + + + + + + + + + $$Device:STM32F103RC$SVD\STM32F103xx.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + firmware + 1 + 0 + 1 + 1 + 1 + .\Listing\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + $K\ARM\ARMCC\bin\fromelf.exe --bin --output=.\Objects\@L.bin !L + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP + DCM.DLL + -pCM3 + SARMCM3.DLL + + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xc000 + + + 1 + 0x8000000 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0xc000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + + USE_HAL_DRIVER,STM32F103xE,VARIANT_SKATEBOARD + + ..\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Startup + + + startup_stm32f103xe.s + 2 + .\startup_stm32f103xe.s + + + + + Src + + + bldc.c + 1 + ..\Src\bldc.c + + + BLDC_controller.c + 1 + ..\Src\BLDC_controller.c + + + BLDC_controller_data.c + 1 + ..\Src\BLDC_controller_data.c control.c @@ -5379,6 +5879,7 @@ + diff --git a/Makefile b/Makefile index 6880e1e..3d4cad7 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,6 @@ Src/bldc.c \ Src/eeprom.c \ Src/hd44780.c \ Src/pcf8574.c \ -Src/comms.c \ Src/stm32f1xx_it.c \ Src/BLDC_controller_data.c \ Src/BLDC_controller.c diff --git a/Src/main.c b/Src/main.c index d042838..2c6165d 100644 --- a/Src/main.c +++ b/Src/main.c @@ -27,7 +27,6 @@ #include "setup.h" #include "config.h" #include "util.h" -#include "comms.h" #include "BLDC_controller.h" /* BLDC's header file */ #include "rtwtypes.h" @@ -191,8 +190,8 @@ int main(void) { poweronMelody(); HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_SET); - int16_t speedL = 0, speedR = 0; - int16_t lastSpeedL = 0, lastSpeedR = 0; + int16_t cmdL = 0, cmdR = 0; + int16_t lastCmdL = 0, lastCmdR = 0; int32_t board_temp_adcFixdt = adc_buffer.temp << 16; // Fixed-point filter output initialized with current ADC converted to fixed-point int16_t board_temp_adcFilt = adc_buffer.temp; @@ -212,7 +211,9 @@ int main(void) { beepShort(4); HAL_Delay(100); steerFixdt = speedFixdt = 0; // reset filters enable = 1; // enable motors + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("-- Motors enabled --\r\n"); + #endif } // ####### VARIANT_HOVERCAR ####### @@ -276,21 +277,21 @@ int main(void) { #endif // ####### MIXER ####### - // speedR = CLAMP((int)(speed * SPEED_COEFFICIENT - steer * STEER_COEFFICIENT), INPUT_MIN, INPUT_MA); - // speedL = CLAMP((int)(speed * SPEED_COEFFICIENT + steer * STEER_COEFFICIENT), INPUT_MIN, INPUT_MA); - mixerFcn(speed << 4, steer << 4, &speedR, &speedL); // This function implements the equations above + // cmdR = CLAMP((int)(speed * SPEED_COEFFICIENT - steer * STEER_COEFFICIENT), INPUT_MIN, INPUT_MA); + // cmdL = CLAMP((int)(speed * SPEED_COEFFICIENT + steer * STEER_COEFFICIENT), INPUT_MIN, INPUT_MA); + mixerFcn(speed << 4, steer << 4, &cmdR, &cmdL); // This function implements the equations above // ####### SET OUTPUTS (if the target change is less than +/- 100) ####### - if ((speedL > lastSpeedL-100 && speedL < lastSpeedL+100) && (speedR > lastSpeedR-100 && speedR < lastSpeedR+100)) { + if ((cmdL > lastCmdL-100 && cmdL < lastCmdL+100) && (cmdR > lastCmdR-100 && cmdR < lastCmdR+100)) { #ifdef INVERT_R_DIRECTION - pwmr = speedR; + pwmr = cmdR; #else - pwmr = -speedR; + pwmr = -cmdR; #endif #ifdef INVERT_L_DIRECTION - pwml = -speedL; + pwml = -cmdL; #else - pwml = speedL; + pwml = cmdL; #endif } #endif @@ -301,22 +302,22 @@ int main(void) { distanceErr = distance - (int)(setDistance * 1345); if (nunchuk_connected == 0) { - speedL = speedL * 0.8f + (CLAMP(distanceErr + (steering*((float)MAX(ABS(distanceErr), 50)) * ROT_P), -850, 850) * -0.2f); - speedR = speedR * 0.8f + (CLAMP(distanceErr - (steering*((float)MAX(ABS(distanceErr), 50)) * ROT_P), -850, 850) * -0.2f); - if ((speedL < lastSpeedL + 50 && speedL > lastSpeedL - 50) && (speedR < lastSpeedR + 50 && speedR > lastSpeedR - 50)) { + cmdL = cmdL * 0.8f + (CLAMP(distanceErr + (steering*((float)MAX(ABS(distanceErr), 50)) * ROT_P), -850, 850) * -0.2f); + cmdR = cmdR * 0.8f + (CLAMP(distanceErr - (steering*((float)MAX(ABS(distanceErr), 50)) * ROT_P), -850, 850) * -0.2f); + if ((cmdL < lastCmdL + 50 && cmdL > lastCmdL - 50) && (cmdR < lastCmdR + 50 && cmdR > lastCmdR - 50)) { if (distanceErr > 0) { enable = 1; } if (distanceErr > -300) { #ifdef INVERT_R_DIRECTION - pwmr = speedR; + pwmr = cmdR; #else - pwmr = -speedR; + pwmr = -cmdR; #endif #ifdef INVERT_L_DIRECTION - pwml = -speedL; + pwml = -cmdL; #else - pwml = speedL; + pwml = cmdL; #endif if (checkRemote) { @@ -410,15 +411,15 @@ int main(void) { // ####### DEBUG SERIAL OUT ####### #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) if (main_loop_counter % 25 == 0) { // Send data periodically every 125 ms - printf("in1:%i in2:%i spdL:%i spdR:%i adcBat:%i BatV:%i adcTemp:%i Temp:%i\r\n", - input1, // 1: INPUT1 - input2, // 2: INPUT2 - speedL, // 3: output command: [-1000, 1000] - speedR, // 4: output command: [-1000, 1000] - adc_buffer.batt1, // 5: for battery voltage calibration + printf("in1:%i in2:%i cmdL:%i cmdR:%i BatADC:%i BatV:%i TempADC:%i Temp:%i\r\n", + input1, // 1: INPUT1 + input2, // 2: INPUT2 + cmdL, // 3: output command: [-1000, 1000] + cmdR, // 4: output command: [-1000, 1000] + adc_buffer.batt1, // 5: for battery voltage calibration batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC, // 6: for verifying battery voltage calibration - board_temp_adcFilt, // 7: for board temperature calibration - board_temp_deg_c); // 8: for verifying board temperature calibration + board_temp_adcFilt, // 7: for board temperature calibration + board_temp_deg_c); // 8: for verifying board temperature calibration } #endif @@ -463,25 +464,18 @@ int main(void) { } else if (rtY_Left.z_errCode || rtY_Right.z_errCode) { // 1 beep (low pitch): Motor error, disable motors enable = 0; beepCount(1, 24, 1); - printf("#ErrL: %i ErrR: %i\r\n", rtY_Left.z_errCode, rtY_Right.z_errCode); } else if (timeoutFlagADC) { // 2 beeps (low pitch): ADC timeout beepCount(2, 24, 1); - printf("#ADC timeout\r\n"); } else if (timeoutFlagSerial) { // 3 beeps (low pitch): Serial timeout beepCount(3, 24, 1); - printf("#Serial timeout\r\n"); } else if (timeoutCnt > TIMEOUT) { // 4 beeps (low pitch): General timeout (PPM, PWM, Nunchuck) beepCount(4, 24, 1); - printf("#General timeout\r\n"); } else if (TEMP_WARNING_ENABLE && board_temp_deg_c >= TEMP_WARNING) { // 5 beeps (low pitch): Mainboard temperature warning beepCount(5, 24, 1); - printf("#STM32 hot: %i\r\n", board_temp_deg_c); } else if (BAT_LVL1_ENABLE && batVoltage < BAT_LVL1) { // 1 beep fast (medium pitch): Low bat 1 beepCount(0, 10, 6); - printf("#Battery empty: %i\r\n", batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC); } else if (BAT_LVL2_ENABLE && batVoltage < BAT_LVL2) { // 1 beep slow (medium pitch): Low bat 2 beepCount(0, 10, 30); - printf("#Battery empty: %i\r\n", batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC); } else if (BEEPS_BACKWARD && ((speed < -50 && speedAvg < 0) || MultipleTapBrake.b_multipleTap)) { // 1 beep fast (high pitch): Backward spinning motors beepCount(0, 5, 1); backwardDrive = 1; @@ -492,7 +486,7 @@ int main(void) { // ####### INACTIVITY TIMEOUT ####### - if (abs(speedL) > 50 || abs(speedR) > 50) { + if (abs(cmdL) > 50 || abs(cmdR) > 50) { inactivity_timeout_counter = 0; } else { inactivity_timeout_counter++; @@ -503,8 +497,8 @@ int main(void) { // HAL_GPIO_TogglePin(LED_PORT, LED_PIN); // This is to measure the main() loop duration with an oscilloscope connected to LED_PIN // Update main loop states - lastSpeedL = speedL; - lastSpeedR = speedR; + lastCmdL = cmdL; + lastCmdR = cmdR; main_loop_counter++; timeoutCnt++; } diff --git a/Src/util.c b/Src/util.c index e115453..d2add04 100644 --- a/Src/util.c +++ b/Src/util.c @@ -133,13 +133,13 @@ static int16_t INPUT_MIN; // [-] Input target minimum limitation static uint8_t cur_spd_valid = 0; static uint8_t inp_cal_valid = 0; static uint16_t INPUT1_TYP_CAL = INPUT1_TYPE; - static uint16_t INPUT1_MIN_CAL = INPUT1_MIN; - static uint16_t INPUT1_MID_CAL = INPUT1_MID; - static uint16_t INPUT1_MAX_CAL = INPUT1_MAX; + static int16_t INPUT1_MIN_CAL = INPUT1_MIN; + static int16_t INPUT1_MID_CAL = INPUT1_MID; + static int16_t INPUT1_MAX_CAL = INPUT1_MAX; static uint16_t INPUT2_TYP_CAL = INPUT2_TYPE; - static uint16_t INPUT2_MIN_CAL = INPUT2_MIN; - static uint16_t INPUT2_MID_CAL = INPUT2_MID; - static uint16_t INPUT2_MAX_CAL = INPUT2_MAX; + static int16_t INPUT2_MIN_CAL = INPUT2_MIN; + static int16_t INPUT2_MID_CAL = INPUT2_MID; + static int16_t INPUT2_MAX_CAL = INPUT2_MAX; #endif #if defined(CONTROL_ADC) @@ -198,6 +198,34 @@ static uint8_t cruiseCtrlAcv = 0; static uint8_t standstillAcv = 0; #endif +/* =========================== Retargeting printf =========================== */ +/* retarget the C library printf function to the USART */ +#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + #ifdef __GNUC__ + #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) + #else + #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) + #endif + PUTCHAR_PROTOTYPE { + #if defined(DEBUG_SERIAL_USART2) + HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000); + #elif defined(DEBUG_SERIAL_USART3) + HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000); + #endif + return ch; + } + + #ifdef __GNUC__ + int _write(int file, char *data, int len) { + int i; + for (i = 0; i < len; i++) { __io_putchar( *data++ );} + return len; + } + #endif +#endif + + + /* =========================== Initialization Functions =========================== */ void BLDC_Init(void) { @@ -280,13 +308,13 @@ void Input_Init(void) { EE_ReadVariable(VirtAddVarTab[0], &writeCheck); if (writeCheck == FLASH_WRITE_KEY) { EE_ReadVariable(VirtAddVarTab[1] , &INPUT1_TYP_CAL); - EE_ReadVariable(VirtAddVarTab[2] , &INPUT1_MIN_CAL); - EE_ReadVariable(VirtAddVarTab[3] , &INPUT1_MID_CAL); - EE_ReadVariable(VirtAddVarTab[4] , &INPUT1_MAX_CAL); + EE_ReadVariable(VirtAddVarTab[2] , (uint16_t *)(intptr_t)INPUT1_MIN_CAL); + EE_ReadVariable(VirtAddVarTab[3] , (uint16_t *)(intptr_t)INPUT1_MID_CAL); + EE_ReadVariable(VirtAddVarTab[4] , (uint16_t *)(intptr_t)INPUT1_MAX_CAL); EE_ReadVariable(VirtAddVarTab[5] , &INPUT2_TYP_CAL); - EE_ReadVariable(VirtAddVarTab[6] , &INPUT2_MIN_CAL); - EE_ReadVariable(VirtAddVarTab[7] , &INPUT2_MID_CAL); - EE_ReadVariable(VirtAddVarTab[8] , &INPUT2_MAX_CAL); + EE_ReadVariable(VirtAddVarTab[6] , (uint16_t *)(intptr_t)INPUT2_MIN_CAL); + EE_ReadVariable(VirtAddVarTab[7] , (uint16_t *)(intptr_t)INPUT2_MID_CAL); + EE_ReadVariable(VirtAddVarTab[8] , (uint16_t *)(intptr_t)INPUT2_MAX_CAL); EE_ReadVariable(VirtAddVarTab[9] , &i_max); EE_ReadVariable(VirtAddVarTab[10], &n_max); rtP_Left.i_max = i_max; @@ -465,31 +493,34 @@ int checkInputType(int16_t min, int16_t mid, int16_t max){ int16_t threshold = 200; #endif - HAL_Delay(10); if ((min / threshold) == (max / threshold) || (mid / threshold) == (max / threshold) || min > max || mid > max) { type = 0; - printf("Input is ignored"); // (MIN and MAX) OR (MID and MAX) are close, disable input + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("ignored"); // (MIN and MAX) OR (MID and MAX) are close, disable input + #endif } else { if ((min / threshold) == (mid / threshold)){ type = 1; - printf("Input is a normal pot"); // MIN and MID are close, it's a normal pot + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("a normal pot"); // MIN and MID are close, it's a normal pot + #endif } else { type = 2; - printf("Input is a mid-resting pot"); // it's a mid resting pot + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("a mid-resting pot"); // it's a mid resting pot + #endif } - HAL_Delay(10); + #ifdef CONTROL_ADC if ((min + INPUT_MARGIN - ADC_PROTECT_THRESH) > 0 && (max - INPUT_MARGIN + ADC_PROTECT_THRESH) < 4095) { - printf(" and protected"); + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf(" AND protected"); + #endif beepLong(2); // Indicate protection by a beep } #endif } - HAL_Delay(10); - printf("\r\n"); - HAL_Delay(10); - return type; } @@ -509,7 +540,10 @@ void adcCalibLim(void) { } #if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER) + + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("Input calibration started...\r\n"); + #endif readInput(); // Inititalization: MIN = a high value, MAX = a low value @@ -538,32 +572,44 @@ void adcCalibLim(void) { HAL_Delay(5); } + printf("Input1 is "); INPUT1_TYP_CAL = checkInputType(INPUT1_MIN_temp, INPUT1_MID_temp, INPUT1_MAX_temp); if (INPUT1_TYP_CAL == INPUT1_TYPE || INPUT1_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto) INPUT1_MIN_CAL = INPUT1_MIN_temp + INPUT_MARGIN; INPUT1_MID_CAL = INPUT1_MID_temp; INPUT1_MAX_CAL = INPUT1_MAX_temp - INPUT_MARGIN; - printf("Input1 OK\r\n"); HAL_Delay(10); + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("..OK\r\n"); + #endif } else { INPUT1_TYP_CAL = 0; // Disable input - printf("Input1 Fail\r\n"); HAL_Delay(10); + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("..NOK\r\n"); + #endif } + printf("Input2 is "); INPUT2_TYP_CAL = checkInputType(INPUT2_MIN_temp, INPUT2_MID_temp, INPUT2_MAX_temp); if (INPUT2_TYP_CAL == INPUT2_TYPE || INPUT2_TYPE == 3) { // Accept calibration only if the type is correct OR type was set to 3 (auto) INPUT2_MIN_CAL = INPUT2_MIN_temp + INPUT_MARGIN; INPUT2_MID_CAL = INPUT2_MID_temp; INPUT2_MAX_CAL = INPUT2_MAX_temp - INPUT_MARGIN; - printf("Input2 OK\r\n"); HAL_Delay(10); + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("..OK\r\n"); + #endif } else { INPUT2_TYP_CAL = 0; // Disable input - printf("Input2 Fail\r\n"); HAL_Delay(10); + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) + printf("..NOK\r\n"); + #endif } inp_cal_valid = 1; // Mark calibration to be saved in Flash at shutdown + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("Limits Input1: TYP:%i MIN:%i MID:%i MAX:%i\r\nLimits Input2: TYP:%i MIN:%i MID:%i MAX:%i\r\n", INPUT1_TYP_CAL, INPUT1_MIN_CAL, INPUT1_MID_CAL, INPUT1_MAX_CAL, INPUT2_TYP_CAL, INPUT2_MIN_CAL, INPUT2_MID_CAL, INPUT2_MAX_CAL); #endif + #endif } /* * Update Maximum Motor Current Limit (via ADC1) and Maximum Speed Limit (via ADC2) @@ -578,7 +624,10 @@ void updateCurSpdLim(void) { } #if !defined(VARIANT_HOVERBOARD) && !defined(VARIANT_TRANSPOTTER) + + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("Torque and Speed limits update started...\r\n"); + #endif int32_t input1_fixdt = input1 << 16; int32_t input2_fixdt = input2 << 16; @@ -610,10 +659,12 @@ void updateCurSpdLim(void) { cur_spd_valid += 2; // Mark update to be saved in Flash at shutdown } + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) // cur_spd_valid: 0 = No limit changed, 1 = Current limit changed, 2 = Speed limit changed, 3 = Both limits changed printf("Limits (%i)\r\nCurrent: fixdt:%li factor%i i_max:%i \r\nSpeed: fixdt:%li factor:%i n_max:%i\r\n", cur_spd_valid, input1_fixdt, cur_factor, rtP_Left.i_max, input2_fixdt, spd_factor, rtP_Left.n_max); #endif + #endif } /* @@ -745,7 +796,9 @@ void cruiseControl(uint8_t button) { void poweroff(void) { enable = 0; + #if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) printf("-- Motors disabled --\r\n"); + #endif buzzerCount = 0; // prevent interraction with beep counter buzzerPattern = 0; for (int i = 0; i < 8; i++) { diff --git a/Src/comms.c b/docs/recycle/comms.c similarity index 77% rename from Src/comms.c rename to docs/recycle/comms.c index 5b88112..61ee47d 100644 --- a/Src/comms.c +++ b/docs/recycle/comms.c @@ -13,31 +13,6 @@ static volatile uint8_t uart_buf[100]; static volatile int16_t ch_buf[8]; //volatile char char_buf[300]; -/* retarget the C library printf function to the USART */ -#if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3) - #ifdef __GNUC__ - #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) - #else - #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) - #endif - PUTCHAR_PROTOTYPE { - #if defined(DEBUG_SERIAL_USART2) - HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000); - #elif defined(DEBUG_SERIAL_USART3) - HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 1000); - #endif - return ch; - } - - #ifdef __GNUC__ - int _write(int file, char *data, int len) { - int i; - for (i = 0; i < len; i++) { __io_putchar( *data++ );} - return len; - } - #endif -#endif - void setScopeChannel(uint8_t ch, int16_t val) { ch_buf[ch] = val; } diff --git a/Inc/comms.h b/docs/recycle/comms.h similarity index 100% rename from Inc/comms.h rename to docs/recycle/comms.h diff --git a/platformio.ini b/platformio.ini index 55c9343..d7612db 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,7 +37,6 @@ monitor_speed = 115200 build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -55,12 +54,11 @@ upload_protocol = stlink ; Serial Port settings (make sure the COM port is correct) monitor_port = COM5 -monitor_speed = 38400 +monitor_speed = 115200 build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -79,7 +77,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -98,7 +95,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -117,7 +113,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -136,7 +131,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -152,14 +146,9 @@ board = genericSTM32F103RC debug_tool = stlink upload_protocol = stlink -; Serial Port settings (make sure the COM port is correct) -monitor_port = COM5 -monitor_speed = 38400 - build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -175,14 +164,9 @@ board = genericSTM32F103RC debug_tool = stlink upload_protocol = stlink -; Serial Port settings (make sure the COM port is correct) -monitor_port = COM5 -monitor_speed = 38400 - build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -201,7 +185,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm @@ -221,7 +204,6 @@ upload_protocol = stlink build_flags = -DUSE_HAL_DRIVER -DSTM32F103xE - -u,_printf_float ; enable float for printf -T./STM32F103RCTx_FLASH.ld -lc -lm