start receiving
This commit is contained in:
		
							
								
								
									
										10
									
								
								Src/main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Src/main.c
									
									
									
									
									
								
							@@ -23,6 +23,8 @@
 | 
			
		||||
/* USER CODE BEGIN Includes */
 | 
			
		||||
#include "SEGGER_RTT.h"
 | 
			
		||||
#include "stm32g0b1xx.h"
 | 
			
		||||
#include "uart.h"
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
/* USER CODE END Includes */
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +62,8 @@ static void MX_USART1_UART_Init(void);
 | 
			
		||||
 | 
			
		||||
/* Private user code ---------------------------------------------------------*/
 | 
			
		||||
/* USER CODE BEGIN 0 */
 | 
			
		||||
 | 
			
		||||
#define BUFFER_SIZE 64
 | 
			
		||||
uint8_t rxBuffer[BUFFER_SIZE];
 | 
			
		||||
/* USER CODE END 0 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -95,13 +98,14 @@ int main(void)
 | 
			
		||||
  MX_DMA_Init();
 | 
			
		||||
  MX_USART1_UART_Init();
 | 
			
		||||
  /* USER CODE BEGIN 2 */
 | 
			
		||||
 | 
			
		||||
  HAL_UART_Receive_DMA(&huart1, rxBuffer, BUFFER_SIZE);
 | 
			
		||||
  /* USER CODE END 2 */
 | 
			
		||||
 | 
			
		||||
  /* Infinite loop */
 | 
			
		||||
  /* USER CODE BEGIN WHILE */
 | 
			
		||||
  while (1)
 | 
			
		||||
  {
 | 
			
		||||
      printf("buf: %s\n", rxBuffer);
 | 
			
		||||
    /* USER CODE END WHILE */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE BEGIN 3 */
 | 
			
		||||
@@ -169,7 +173,7 @@ static void MX_USART1_UART_Init(void)
 | 
			
		||||
 | 
			
		||||
  /* USER CODE END USART1_Init 1 */
 | 
			
		||||
  huart1.Instance = USART1;
 | 
			
		||||
  huart1.Init.BaudRate = 9600;
 | 
			
		||||
  huart1.Init.BaudRate = 250000;
 | 
			
		||||
  huart1.Init.WordLength = UART_WORDLENGTH_8B;
 | 
			
		||||
  huart1.Init.StopBits = UART_STOPBITS_1;
 | 
			
		||||
  huart1.Init.Parity = UART_PARITY_NONE;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user