2019-09-12 10:53 PM
Hi All,
I am trying to receive data on USART1 but I am not getting data on USART1. Apart from USART1 USART2 & 3 is working fine.
As per datasheet USART1 pins are showing on (PE1, PE0 or PC5 & PC4). When I am use PE1 & PE0 that time USART1 is not working but if I config PC5 & PC4 pins USART1 working fine.
I want to know why this is happening because GND pins and RX TX pins are connected right and checked twice.
if anyone has any Idea let me know.
MCU : STM32F303CVT6 (Discovery board)
Data : on Terminal
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
UART_HandleTypeDef huart1;
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint8_t rx[6] = {'A','M','B','U','J'}, tx[6];
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Receive(&huart1, tx, 1, 10);
if (tx[0] == 's'){
HAL_UART_Transmit(&huart1, rx, sizeof(rx), 100);
tx[0] = '0';
}
}
/* USER CODE END 3 */
}
2019-09-12 11:36 PM
> When I am use PE1 & PE0 that time USART1 is not working
Isn't there something else connected to some of these pins on the Discovery board? Check the schematics.
JW
2019-09-12 11:50 PM
>> Isn't there something else connected to some of these pins on the Discovery board? Check the schematics.
No there is not any thing connected to the these pins on discovery schematic.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.