stm32f1

why is there a delay between (DR register written) and (data really showed) in UART on STM32F103CB?

时光怂恿深爱的人放手 提交于 2021-02-11 14:32:29
问题 I'm curious about the delay time between the title mentioned, I toggled an IO when I wrote data into UART->DR, the delay time varies from 3 micro seconds to 10x micro seconds int main(void) { /* initial code generated by STMCubeMX */ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_USART1_UART_Init(); while (1) { HAL_Delay(50); if (USART_GetFlagStatus(&huart1, USART_SR_TXE) == SET) { USART_SendData(&huart1, 'F'); } } } void USART_SendData(UART_HandleTypeDef *huart, uint16_t Data) { assert

Light the LED on STM32F103C8T6

懵懂的女人 提交于 2020-04-29 15:42:50
问题 I'm trying the light an LED (on port c, pin 13) on STM32F103C8T6. I'm not using IDE. Code: #include "include/stm32f10x.h" int main() { RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; GPIOC->CRH &= ~GPIO_CRH_CNF13; GPIOC->CRH |= GPIO_CRH_MODE13_0; GPIOC->BSRR = GPIO_BSRR_BR13; while(1) { GPIOC->BSRR = GPIO_BSRR_BS13; } return 0; } Links to include files in include directory: system_stm32f10x.h core_cmInstr.h core_cmFunc.h core_cm3.h stm32f10x.h part1 stm32f10x.h part2 That's how I compile it arm-none-eabi

Why USART2 Send a Garbage Value?

两盒软妹~` 提交于 2020-01-07 08:28:13
问题 Hello i'm using stm32f103c8 and i'm trying to use usart2 but it does not work . when i'm using USART1 with the same configuration of USART2 it works with me well . but USART2 send garbage to the PC terminal can someone help me to solve the problem in the USART2 ? This is the configuration of USART2 : int main(void){ RCC_VidInit(); //INTIALIZE EXTERNAL CRYSTAL OSCILATOR = 8 MHZ RCC_VidEnablePeripheralClock( APB2_BUS , 2 ); //ENABLE CLOCK OF GPIOA CLR_BIT( GPIOA->CRL , 8 ); SET_BIT( GPIOA->CRL