From bca047fa687494b1e738c74a156a915fa5077690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiovics=20D=C3=A1niel?= Date: Tue, 2 May 2023 19:03:03 +0200 Subject: [PATCH 01/31] uart send circular buffer added, baudrate increased to 1Mb/s, motor switched to brake_mode --- firmware/Drivers/uart/uart.c | 183 +++++++++++++++++++++++++++++++++++ firmware/Drivers/uart/uart.h | 66 +++++++++++++ 2 files changed, 249 insertions(+) create mode 100644 firmware/Drivers/uart/uart.c create mode 100644 firmware/Drivers/uart/uart.h diff --git a/firmware/Drivers/uart/uart.c b/firmware/Drivers/uart/uart.c new file mode 100644 index 0000000..0bbf6b7 --- /dev/null +++ b/firmware/Drivers/uart/uart.c @@ -0,0 +1,183 @@ +/* + * uart.c + * + * Created on: Apr 11, 2023 + * Author: dkiovics + */ + +#include "uart.h" + + +#include +#include +#include +#include + + + +void uart_init(volatile Uart *uart, UART_HandleTypeDef *huart, IRQn_Type uartIr, IRQn_Type sendDMAIr, uint16_t writeBufferLenght, uint16_t readBufferLenght){ + uart->huart = huart; + uart->writeBufferLenght = writeBufferLenght; + uart->readBufferLenght = readBufferLenght; + uart->mostRecentNewLinePos = -1; + uart->startOfReadData = 0; + uart->readPtr = 0; + uart->readPtrOverflow = 0; + uart->uartIr = uartIr; + uart->sendDMAIr = sendDMAIr; + + uart->startOfWriteData = -1; + uart->endOfWriteData = writeBufferLenght - 1; + uart->transmissionInProgress = 0; + + uart->writeBuffer = (char*)malloc(writeBufferLenght+1); + uart->writeCircularBuffer = (char*)malloc(writeBufferLenght+1); + uart->readCircularBuffer = (char*)malloc(readBufferLenght+1); + + HAL_UART_Receive_IT(uart->huart, (uint8_t*)uart->readCircularBuffer, 1); + uart->ok = 1; +} + + +void uart_handleTransmitCplt(volatile Uart *uart, UART_HandleTypeDef *huart){ + if(uart->huart != huart || !uart->ok) + return; + if(uart->startOfWriteData == -1){ + uart->transmissionInProgress = 0; + return; + } + int charCount; + if(uart->startOfWriteData <= uart->endOfWriteData){ + charCount = uart->endOfWriteData - uart->startOfWriteData + 1; + HAL_UART_Transmit_DMA(uart->huart, (uint8_t*)uart->writeCircularBuffer + uart->startOfWriteData, charCount); + uart->startOfWriteData = -1; + } + else{ + charCount = uart->writeBufferLenght - uart->startOfWriteData; + HAL_UART_Transmit_DMA(uart->huart, (uint8_t*)uart->writeCircularBuffer + uart->startOfWriteData, charCount); + uart->startOfWriteData = 0; + } +} + + +void uart_transmit(volatile Uart *uart, const char *fmt, ...){ + va_list args; + va_start(args, fmt); + + int size = vsprintf((char*)uart->writeBuffer, fmt, args); + if(size<=0) + return; + + int spaceTillBufferEnd = uart->writeBufferLenght - uart->endOfWriteData - 1; + + if(spaceTillBufferEnd >= size){ + memcpy((void*)uart->writeCircularBuffer + uart->endOfWriteData + 1, (const void*)uart->writeBuffer, size); + HAL_NVIC_DisableIRQ(uart->uartIr); + HAL_NVIC_DisableIRQ(uart->sendDMAIr); + if(uart->startOfWriteData == -1){ + if(uart->transmissionInProgress){ + uart->startOfWriteData = uart->endOfWriteData + 1; + }else{ + HAL_UART_Transmit_DMA(uart->huart, (uint8_t*)uart->writeCircularBuffer + uart->endOfWriteData + 1, size); + uart->transmissionInProgress = 1; + } + } + uart->endOfWriteData = uart->endOfWriteData + size; + HAL_NVIC_EnableIRQ(uart->uartIr); + HAL_NVIC_EnableIRQ(uart->sendDMAIr); + }else{ + if(spaceTillBufferEnd > 0) + memcpy((void*)uart->writeCircularBuffer + uart->endOfWriteData + 1, (const void*)uart->writeBuffer, spaceTillBufferEnd); + memcpy((void*)uart->writeCircularBuffer, (const void*)uart->writeBuffer + spaceTillBufferEnd, size - spaceTillBufferEnd); + HAL_NVIC_DisableIRQ(uart->uartIr); + HAL_NVIC_DisableIRQ(uart->sendDMAIr); + if(uart->startOfWriteData == -1){ + if(spaceTillBufferEnd == 0){ + if(uart->transmissionInProgress){ + uart->startOfWriteData = 0; + }else{ + uart->transmissionInProgress = 1; + HAL_UART_Transmit_DMA(uart->huart, (uint8_t*)uart->writeCircularBuffer, size); + } + uart->endOfWriteData = size - 1; + }else{ + if(uart->transmissionInProgress){ + uart->startOfWriteData = uart->endOfWriteData + 1; + }else{ + uart->transmissionInProgress = 1; + uart->startOfWriteData = 0; + HAL_UART_Transmit_DMA(uart->huart, (uint8_t*)uart->writeCircularBuffer + uart->endOfWriteData + 1, spaceTillBufferEnd); + } + uart->endOfWriteData = size - spaceTillBufferEnd - 1; + } + }else{ + uart->endOfWriteData = size - spaceTillBufferEnd - 1; + } + HAL_NVIC_EnableIRQ(uart->uartIr); + HAL_NVIC_EnableIRQ(uart->sendDMAIr); + } +} + + +void uart_handleReceiveCplt(volatile Uart *uart, UART_HandleTypeDef *huart){ + if(uart->huart != huart) + return; + + char c = uart->readCircularBuffer[uart->readPtr]; + + if(c == '\r'){ + HAL_UART_Receive_IT(uart->huart, (uint8_t*)uart->readCircularBuffer + uart->readPtr, 1); + return; + } + + if(uart->readCircularBuffer[uart->readPtr] == '\n'){ + uart->mostRecentNewLinePos = uart->readPtr; + } + + uart->readPtr++; + if(uart->readPtr == uart->readBufferLenght){ + uart->readPtrOverflow = 1; + uart->readPtr = 0; + } + + if(uart->readPtr == uart->mostRecentNewLinePos) + uart->mostRecentNewLinePos = -1; + + if(uart->readPtr == uart->startOfReadData){ + uart->startOfReadData++; + if(uart->startOfReadData == uart->readBufferLenght) + uart->startOfReadData = 0; + } + + HAL_UART_Receive_IT(uart->huart, (uint8_t*)uart->readCircularBuffer + uart->readPtr, 1); +} + + +uint8_t uart_receive(volatile Uart *uart, char* data){ + HAL_NVIC_DisableIRQ(uart->uartIr); + int32_t newLine = uart->mostRecentNewLinePos; + uint16_t startOfData = uart->startOfReadData; + if(newLine == -1){ + HAL_NVIC_EnableIRQ(uart->uartIr); + return 0; + } + uart->mostRecentNewLinePos = -1; + uart->startOfReadData = newLine+1; + if(uart->startOfReadData == uart->readBufferLenght) + uart->startOfReadData = 0; + HAL_NVIC_EnableIRQ(uart->uartIr); + + if(startOfData > newLine){ + uint16_t diff = uart->readBufferLenght - startOfData; + memcpy(data, (const void*)uart->readCircularBuffer + startOfData, diff); + memcpy(data + diff, (const void*)uart->readCircularBuffer, newLine + 1); + data[diff + newLine + 1] = '\0'; + }else{ + memcpy(data, (const void*)uart->readCircularBuffer + startOfData, newLine - startOfData + 1); + data[newLine - startOfData + 1] = '\0'; + } + + return 1; +} + + diff --git a/firmware/Drivers/uart/uart.h b/firmware/Drivers/uart/uart.h new file mode 100644 index 0000000..1c3e021 --- /dev/null +++ b/firmware/Drivers/uart/uart.h @@ -0,0 +1,66 @@ +/* + * uart.h + * + * Created on: Apr 11, 2023 + * Author: dkiovics + */ + +#ifndef UART_UART_H_ +#define UART_UART_H_ + + +#include "stm32f1xx_hal.h" + + +typedef struct { + UART_HandleTypeDef* huart; + IRQn_Type uartIr; + IRQn_Type sendDMAIr; + + uint16_t writeBufferLenght; + uint16_t readBufferLenght; + + char* writeCircularBuffer; + int32_t startOfWriteData; + int32_t endOfWriteData; + char* writeBuffer; + uint8_t transmissionInProgress; + + char* readCircularBuffer; + uint16_t startOfReadData; + uint16_t readPtr; + uint8_t readPtrOverflow; + int32_t mostRecentNewLinePos; + uint8_t ok; +} Uart; + + +/* + * Initializes the UART object + */ +void uart_init(volatile Uart* uart, UART_HandleTypeDef *huart, IRQn_Type uartIr, IRQn_Type sendDMAIr, uint16_t writeBufferLenght, uint16_t readBufferLenght); + +/* + * Call when the HAL_UART_TxCpltCallback function is called + */ +void uart_handleTransmitCplt(volatile Uart* uart, UART_HandleTypeDef *huart); + +/* + * Call when the HAL_UART_RxCpltCallback function is called + */ +void uart_handleReceiveCplt(volatile Uart* uart, UART_HandleTypeDef *huart); + +/* + * Transmits the data (max lenght is writeBufferLenght) + */ +void uart_transmit(volatile Uart* uart, const char *fmt, ...); + +/* + * Receives the data until the last received \n, ignores \r (max lenght is readBufferLenght) + * Puts a \0 at the end of the data, returns false, if no data is available + */ +uint8_t uart_receive(volatile Uart* uart, char* data); + + + +#endif /* UART_UART_H_ */ From 18b0f4be958d06e5d06ff652ec82c6fb380d85de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiovics=20D=C3=A1niel?= Date: Tue, 2 May 2023 19:04:49 +0200 Subject: [PATCH 02/31] uart send circular buffer added, baudrate increased to 1Mb/s, motor switched to brake_mode 2 --- firmware/Application/application.c | 6 ++++ firmware/Core/Inc/robotcontrol.h | 3 +- firmware/Core/Inc/stm32f1xx_hal_conf.h | 2 +- firmware/Core/Inc/stm32f1xx_it.h | 1 + firmware/Core/Src/main.c | 34 +++++++++++++++++++++-- firmware/Core/Src/robotcontrol.c | 15 +++++----- firmware/Core/Src/stm32f1xx_hal_msp.c | 21 ++++++++++++++ firmware/Core/Src/stm32f1xx_it.c | 15 ++++++++++ firmware/Drivers/motor/motor.c | 2 +- firmware/tanfolyamrobot.ioc | 38 ++++++++++++++++++-------- 10 files changed, 113 insertions(+), 24 deletions(-) diff --git a/firmware/Application/application.c b/firmware/Application/application.c index c1c7a57..19f45cd 100644 --- a/firmware/Application/application.c +++ b/firmware/Application/application.c @@ -8,6 +8,12 @@ int application() { lcdPrintf(0, 0, "Hello"); lcdPrintf(1, 5, "World!"); + for(int p = 0; p < 50; p++){ + uartPrintf("Na csaa\n"); + uartPrintf("Szia "); + uartPrintf("hello!\n"); + } + delayMs(2000); return 0; diff --git a/firmware/Core/Inc/robotcontrol.h b/firmware/Core/Inc/robotcontrol.h index 6baa6a1..785de8f 100644 --- a/firmware/Core/Inc/robotcontrol.h +++ b/firmware/Core/Inc/robotcontrol.h @@ -15,12 +15,13 @@ #include "speed_control.h" #include "encoder.h" #include "color_sensor.h" +#include "uart.h" #include "robotcontrol-api.h" void robotControlInit(volatile Servo* usServo, volatile UltraSonic* usSensor, volatile ColorSensor* colorSensor, volatile SpeedControl* scLeft, volatile SpeedControl* scRight, volatile Encoder* encoderLeft, volatile Encoder* encoderRight, - UART_HandleTypeDef* usbUart); + volatile Uart* usbUart); #endif /* INC_ROBOTCONTROL_H_ */ diff --git a/firmware/Core/Inc/stm32f1xx_hal_conf.h b/firmware/Core/Inc/stm32f1xx_hal_conf.h index 80f8ec4..d439748 100644 --- a/firmware/Core/Inc/stm32f1xx_hal_conf.h +++ b/firmware/Core/Inc/stm32f1xx_hal_conf.h @@ -41,7 +41,7 @@ /*#define HAL_CORTEX_MODULE_ENABLED */ /*#define HAL_CRC_MODULE_ENABLED */ /*#define HAL_DAC_MODULE_ENABLED */ -/*#define HAL_DMA_MODULE_ENABLED */ +#define HAL_DMA_MODULE_ENABLED /*#define HAL_ETH_MODULE_ENABLED */ /*#define HAL_FLASH_MODULE_ENABLED */ #define HAL_GPIO_MODULE_ENABLED diff --git a/firmware/Core/Inc/stm32f1xx_it.h b/firmware/Core/Inc/stm32f1xx_it.h index f0580b4..825cd6e 100644 --- a/firmware/Core/Inc/stm32f1xx_it.h +++ b/firmware/Core/Inc/stm32f1xx_it.h @@ -57,6 +57,7 @@ void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void EXTI0_IRQHandler(void); +void DMA1_Channel4_IRQHandler(void); void ADC1_2_IRQHandler(void); void EXTI9_5_IRQHandler(void); void TIM1_UP_IRQHandler(void); diff --git a/firmware/Core/Src/main.c b/firmware/Core/Src/main.c index 8c72201..7b37f0e 100644 --- a/firmware/Core/Src/main.c +++ b/firmware/Core/Src/main.c @@ -35,6 +35,7 @@ #include "ultrasonic.h" #include "servo.h" #include "motor.h" +#include "uart.h" #include "speed_control.h" #include "application.h" /* USER CODE END Includes */ @@ -59,6 +60,8 @@ #define LCD_BL_PWM_INVERTED 0 #define USB_UART (&huart1) +#define USB_UART_IR USART1_IRQn +#define USB_UART_DMA_IR DMA1_Channel4_IRQn #define VBAT_ADC (&hadc1) #define VBAT_ADC_TIMER (&htim4) @@ -135,6 +138,7 @@ TIM_HandleTypeDef htim4; UART_HandleTypeDef huart1; UART_HandleTypeDef huart3; +DMA_HandleTypeDef hdma_usart1_tx; /* USER CODE BEGIN PV */ const uint8_t lcdRows = 2; @@ -157,6 +161,8 @@ volatile Motor* motor2; volatile SpeedControl* speedControl1; volatile SpeedControl* speedControl2; +volatile Uart uart1; + volatile uint16_t batteryVoltage = 0; volatile uint8_t batteryAdcBusy = 0; @@ -166,6 +172,7 @@ volatile SoftPwm* lcdBacklightPwm; /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); +static void MX_DMA_Init(void); static void MX_TIM4_Init(void); static void MX_USART1_UART_Init(void); static void MX_USART3_UART_Init(void); @@ -295,6 +302,10 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart) { } } +void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { + uart_handleTransmitCplt(&uart1, huart); +} + void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { switch (GPIO_Pin) { case ENC1_A_Pin: encoderHandlerA(&encoder1); break; @@ -369,6 +380,7 @@ int main(void) /* Initialize all configured peripherals */ MX_GPIO_Init(); + MX_DMA_Init(); MX_TIM4_Init(); MX_USART1_UART_Init(); MX_USART3_UART_Init(); @@ -402,6 +414,8 @@ int main(void) LCD_D6_GPIO_Port, LCD_D6_Pin, LCD_D7_GPIO_Port, LCD_D7_Pin, lcdRows, lcdCols); + uart_init(&uart1, USB_UART, USB_UART_IR, USB_UART_DMA_IR, 500, 10); + if (exitDfu) { lcdPuts(0, 0, "Exit DFU mode..."); HAL_Delay(1000); @@ -481,7 +495,7 @@ int main(void) servo = servoCreate(SERVO_TIMER, SERVO_CHANNEL, SERVO_PWM_PERIOD, PwmOutput_P, SERVO_START_POS, SERVO_END_POS); - robotControlInit(servo, &us, &colorSensor, speedControl2, speedControl1, &encoder2, &encoder1, USB_UART); + robotControlInit(servo, &us, &colorSensor, speedControl2, speedControl1, &encoder2, &encoder1, &uart1); HAL_Delay(1000); lcdClear(); @@ -916,7 +930,7 @@ static void MX_USART1_UART_Init(void) /* USER CODE END USART1_Init 1 */ huart1.Instance = USART1; - huart1.Init.BaudRate = 115200; + huart1.Init.BaudRate = 1000000; huart1.Init.WordLength = UART_WORDLENGTH_8B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_NONE; @@ -966,6 +980,22 @@ static void MX_USART3_UART_Init(void) } +/** + * Enable DMA controller clock + */ +static void MX_DMA_Init(void) +{ + + /* DMA controller clock enable */ + __HAL_RCC_DMA1_CLK_ENABLE(); + + /* DMA interrupt init */ + /* DMA1_Channel4_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn); + +} + /** * @brief GPIO Initialization Function * @param None diff --git a/firmware/Core/Src/robotcontrol.c b/firmware/Core/Src/robotcontrol.c index cf76c5b..d86c3f6 100644 --- a/firmware/Core/Src/robotcontrol.c +++ b/firmware/Core/Src/robotcontrol.c @@ -15,7 +15,7 @@ static volatile SpeedControl* scL; static volatile SpeedControl* scR; static volatile Encoder* encoderL; static volatile Encoder* encoderR; -static UART_HandleTypeDef* uart; +static volatile Uart* uart1; /** * Save the pointer to every driver instance used here @@ -23,7 +23,7 @@ static UART_HandleTypeDef* uart; void robotControlInit(volatile Servo* usServo, volatile UltraSonic* usSensor, volatile ColorSensor* colorSensor, volatile SpeedControl* scLeft, volatile SpeedControl* scRight, volatile Encoder* encoderLeft, volatile Encoder* encoderRight, - UART_HandleTypeDef* usbUart) { + volatile Uart* usbUart) { servo = usServo; us = usSensor; cs = colorSensor; @@ -31,7 +31,7 @@ void robotControlInit(volatile Servo* usServo, volatile UltraSonic* usSensor, vo scR = scRight; encoderL = encoderLeft; encoderR = encoderRight; - uart = usbUart; + uart1 = usbUart; } @@ -83,13 +83,14 @@ uint32_t getEncoderPosition(uint8_t mot_lr) { int uartPrintf(const char *fmt, ...) { va_list args; va_start(args, fmt); - +/* char str[256]; int size = vsprintf(str, fmt, args); + str[size] = '\0'; +*/ + uart_transmit(uart1, fmt, args); - HAL_UART_Transmit_IT(uart, (uint8_t*)str, size); - - return size; + return 0; } diff --git a/firmware/Core/Src/stm32f1xx_hal_msp.c b/firmware/Core/Src/stm32f1xx_hal_msp.c index 8c48a14..3482cb9 100644 --- a/firmware/Core/Src/stm32f1xx_hal_msp.c +++ b/firmware/Core/Src/stm32f1xx_hal_msp.c @@ -24,6 +24,7 @@ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ +extern DMA_HandleTypeDef hdma_usart1_tx; /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN TD */ @@ -397,6 +398,23 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + /* USART1 DMA Init */ + /* USART1_TX Init */ + hdma_usart1_tx.Instance = DMA1_Channel4; + hdma_usart1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; + hdma_usart1_tx.Init.PeriphInc = DMA_PINC_DISABLE; + hdma_usart1_tx.Init.MemInc = DMA_MINC_ENABLE; + hdma_usart1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + hdma_usart1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; + hdma_usart1_tx.Init.Mode = DMA_NORMAL; + hdma_usart1_tx.Init.Priority = DMA_PRIORITY_LOW; + if (HAL_DMA_Init(&hdma_usart1_tx) != HAL_OK) + { + Error_Handler(); + } + + __HAL_LINKDMA(huart,hdmatx,hdma_usart1_tx); + /* USART1 interrupt Init */ HAL_NVIC_SetPriority(USART1_IRQn, 1, 0); HAL_NVIC_EnableIRQ(USART1_IRQn); @@ -458,6 +476,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); + /* USART1 DMA DeInit */ + HAL_DMA_DeInit(huart->hdmatx); + /* USART1 interrupt DeInit */ HAL_NVIC_DisableIRQ(USART1_IRQn); /* USER CODE BEGIN USART1_MspDeInit 1 */ diff --git a/firmware/Core/Src/stm32f1xx_it.c b/firmware/Core/Src/stm32f1xx_it.c index 0643dbc..cd7fa00 100644 --- a/firmware/Core/Src/stm32f1xx_it.c +++ b/firmware/Core/Src/stm32f1xx_it.c @@ -61,6 +61,7 @@ extern TIM_HandleTypeDef htim1; extern TIM_HandleTypeDef htim2; extern TIM_HandleTypeDef htim3; extern TIM_HandleTypeDef htim4; +extern DMA_HandleTypeDef hdma_usart1_tx; extern UART_HandleTypeDef huart1; /* USER CODE BEGIN EV */ @@ -216,6 +217,20 @@ void EXTI0_IRQHandler(void) /* USER CODE END EXTI0_IRQn 1 */ } +/** + * @brief This function handles DMA1 channel4 global interrupt. + */ +void DMA1_Channel4_IRQHandler(void) +{ + /* USER CODE BEGIN DMA1_Channel4_IRQn 0 */ + + /* USER CODE END DMA1_Channel4_IRQn 0 */ + HAL_DMA_IRQHandler(&hdma_usart1_tx); + /* USER CODE BEGIN DMA1_Channel4_IRQn 1 */ + + /* USER CODE END DMA1_Channel4_IRQn 1 */ +} + /** * @brief This function handles ADC1 and ADC2 global interrupts. */ diff --git a/firmware/Drivers/motor/motor.c b/firmware/Drivers/motor/motor.c index 2c882e1..e6f71c2 100644 --- a/firmware/Drivers/motor/motor.c +++ b/firmware/Drivers/motor/motor.c @@ -41,7 +41,7 @@ void motorInit(Motor* motor, Pwm* pwm1, Pwm* pwm2, uint8_t reversed) { motor->pwm1 = pwm1; motor->pwm2 = pwm2; motor->reversed = reversed; - motor->runMode = MotorRunMode_Coast; + motor->runMode = MotorRunMode_Brake; motor->speed = 0; motorSetSpeed(motor, motor->speed); } diff --git a/firmware/tanfolyamrobot.ioc b/firmware/tanfolyamrobot.ioc index 0e920d5..fabc361 100644 --- a/firmware/tanfolyamrobot.ioc +++ b/firmware/tanfolyamrobot.ioc @@ -7,22 +7,34 @@ ADC1.NbrOfConversionFlag=1 ADC1.Rank-0\#ChannelRegularConversion=1 ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_239CYCLES_5 ADC1.master=1 +Dma.Request0=USART1_TX +Dma.RequestsNb=1 +Dma.USART1_TX.0.Direction=DMA_MEMORY_TO_PERIPH +Dma.USART1_TX.0.Instance=DMA1_Channel4 +Dma.USART1_TX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE +Dma.USART1_TX.0.MemInc=DMA_MINC_ENABLE +Dma.USART1_TX.0.Mode=DMA_NORMAL +Dma.USART1_TX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE +Dma.USART1_TX.0.PeriphInc=DMA_PINC_DISABLE +Dma.USART1_TX.0.Priority=DMA_PRIORITY_LOW +Dma.USART1_TX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority File.Version=6 GPIO.groupedBy=Group By Peripherals KeepUserPlacement=false Mcu.CPN=STM32F103R8T6 Mcu.Family=STM32F1 Mcu.IP0=ADC1 -Mcu.IP1=NVIC -Mcu.IP2=RCC -Mcu.IP3=SYS -Mcu.IP4=TIM1 -Mcu.IP5=TIM2 -Mcu.IP6=TIM3 -Mcu.IP7=TIM4 -Mcu.IP8=USART1 -Mcu.IP9=USART3 -Mcu.IPNb=10 +Mcu.IP1=DMA +Mcu.IP10=USART3 +Mcu.IP2=NVIC +Mcu.IP3=RCC +Mcu.IP4=SYS +Mcu.IP5=TIM1 +Mcu.IP6=TIM2 +Mcu.IP7=TIM3 +Mcu.IP8=TIM4 +Mcu.IP9=USART1 +Mcu.IPNb=11 Mcu.Name=STM32F103R(8-B)Tx Mcu.Package=LQFP64 Mcu.Pin0=PC13-TAMPER-RTC @@ -77,6 +89,7 @@ MxCube.Version=5.6.0 MxDb.Version=DB.5.0.60 NVIC.ADC1_2_IRQn=true\:15\:0\:true\:false\:true\:true\:true\:true NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.EXTI0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true @@ -264,7 +277,7 @@ ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_TIM4_Init-TIM4-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_USART3_UART_Init-USART3-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_TIM1_Init-TIM1-false-HAL-true,8-MX_TIM2_Init-TIM2-false-HAL-true,9-MX_ADC1_Init-ADC1-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM4_Init-TIM4-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_USART3_UART_Init-USART3-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_TIM1_Init-TIM1-false-HAL-true,9-MX_TIM2_Init-TIM2-false-HAL-true,10-MX_ADC1_Init-ADC1-false-HAL-true RCC.ADCFreqValue=8000000 RCC.ADCPresc=RCC_ADCPCLK2_DIV8 RCC.AHBFreq_Value=64000000 @@ -334,7 +347,8 @@ TIM4.ICPolarity_CH2=TIM_INPUTCHANNELPOLARITY_FALLING TIM4.IPParameters=Prescaler,Period,AutoReloadPreload,CounterMode,Channel-Input_Capture1_from_TI1,ICPolarity_CH1,Channel-Input_Capture2_from_TI1,ICPolarity_CH2,Channel-Output Compare4 No Output,Channel-Input_Capture3_from_TI3 TIM4.Period=0xffff TIM4.Prescaler=32 -USART1.IPParameters=VirtualMode +USART1.BaudRate=1000000 +USART1.IPParameters=VirtualMode,BaudRate USART1.VirtualMode=VM_ASYNC USART3.IPParameters=VirtualMode USART3.VirtualMode=VM_ASYNC From 73308ee8c13094a9d9cbc92381ac64e1af110468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kiovics=20D=C3=A1niel?= Date: Sat, 17 Jun 2023 16:50:58 +0200 Subject: [PATCH 03/31] environment settings fix --- firmware/.cproject | 16 +++++++++++----- firmware/.settings/language.settings.xml | 4 ++-- firmware/Application/application.c | 6 ------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/firmware/.cproject b/firmware/.cproject index d4b30b6..41cc071 100644 --- a/firmware/.cproject +++ b/firmware/.cproject @@ -14,7 +14,7 @@ - + @@ -117,22 +118,26 @@