usart

Receiving a string through UART in STM32F4

萝らか妹 提交于 2021-01-28 12:33:54
问题 I've written this code to receive a series of char variable through USART6 and have them stored in a string. But the problem is first received value is just a junk! Any help would be appreciated in advance. while(1) { //memset(RxBuffer, 0, sizeof(RxBuffer)); i = 0; requestRead(&dt, 1); RxBuffer[i++] = dt; while (i < 11) { requestRead(&dt, 1); RxBuffer[i++] = dt; HAL_Delay(5); } function prototype static void requestRead(char *buffer, uint16_t length) { while (HAL_UART_Receive_IT(&huart6,

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

stm32f0 uart programming

笑着哭i 提交于 2019-12-11 01:38:37
问题 i'm trying to get the usart to work on my stm32f0-discovery but now i found out that the documentation about this kinda " lacks" so is there anyone who has an example of any usart working for the stm32f050? thanks. Bart Teunissen 回答1: Okay after two days of searching around on the internet. I found this little piece of code, and i managed to get it working: USART_InitTypeDef USART_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); RCC

ADC single conversion on STM32

青春壹個敷衍的年華 提交于 2019-12-10 09:33:07
问题 I'm studying ADC programming on STM32 F103x and starting with the simplest case - single conversion. The internal temperature sensor (connected to ADC1) value is measured and sending it to COM port by using USART. A target seems clear but when I try to download source code to flash, it doesn't send any data to COM port. USART function works well, I guess the problems come from ADC configuration part because I'm being hung in loop of waiting complete conversion: while(ADC_GetFlagStatus(ADC1,

Communication between USART and SPI

孤街浪徒 提交于 2019-12-08 13:28:50
问题 Is it possible the communication between USART2 and SPI1 in stm32f10x??? I asked because USART2 clock works with APB1 and SPI1 clock works with APB2. and in practice i could have communication between USART1 and SPI1 but couldnt with USART2. 回答1: Well irrespective of clock , you can communicate with individual peripherals. APB1 and APB2 are just clock sources and it should not impact the communication. 来源: https://stackoverflow.com/questions/24778183/communication-between-usart-and-spi

ATMEGA32 UART Communication

别说谁变了你拦得住时间么 提交于 2019-12-08 03:50:51
问题 I am trying to do serial communication in ATMEGA32 and I have a question: In asynchronous serial communication both UBRRH and UCSRC registers have same location. I don't know which conditions that location will act as UBRRH and for which conditions, it will act as UCSRC . I need different values for each register according to the work assigned to those registers In the datasheet, they have mentioned the use of URSEL bit for selection betweem two registers but somehow I am not getting that.

ATMEGA32 UART Communication

房东的猫 提交于 2019-12-06 14:51:54
I am trying to do serial communication in ATMEGA32 and I have a question: In asynchronous serial communication both UBRRH and UCSRC registers have same location. I don't know which conditions that location will act as UBRRH and for which conditions, it will act as UCSRC . I need different values for each register according to the work assigned to those registers In the datasheet, they have mentioned the use of URSEL bit for selection betweem two registers but somehow I am not getting that. The answer is: Yes, the URSEL bit. According to the datasheet: When doing a write access of this I/O

ADC single conversion on STM32

跟風遠走 提交于 2019-12-05 16:22:52
I'm studying ADC programming on STM32 F103x and starting with the simplest case - single conversion. The internal temperature sensor (connected to ADC1) value is measured and sending it to COM port by using USART. A target seems clear but when I try to download source code to flash, it doesn't send any data to COM port. USART function works well, I guess the problems come from ADC configuration part because I'm being hung in loop of waiting complete conversion: while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); //Wail for conversion complete Here is my source code so far. /* Includes -----