2022-06-27 11:44 AM
First the GUI is all screwed up.
When I look at USART2 It gives me the choices for
GPIO output level,
GPIO mode,
GPIO Pull-up/Pull-down
Maximum output speed
User Label,
it is missing Fast Mode.
I click down to USART1_TX and the list is different. It has
GPIO mode,
GPIO Pull-up/Pull-down
Maximum output speed,
Fast Mode
User Label
This one is missing GPIO Output Level.
And it says it is "Modified" I told it to revert to the default and it is still "Modified"
This is a known problem, but it does not help me that it is known.
Here is the code generated.
/**
* @brief USART1 Initialization Function
* @param None
* @retval None
*/
static void MX_USART1_UART_Init(void)
{
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
}
It looks good. I do not see an error in it. Can anyone else?
In my main program it has
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_DMA_Init();
MX_ADC1_Init();
MX_I2C1_Init();
MX_TIM2_Init();
MX_TIM3_Init();
MX_TIM14_Init();
MX_USART2_UART_Init();
MX_USART1_UART_Init();
/* Initialize interrupts */
MX_NVIC_Init();
/* USER CODE BEGIN 2 */
uint8_t data[] = "Hello World ***********\r\n";
HAL_UART_Transmit(&huart1, data, sizeof(data), 100);
HAL_Delay(250);
__NOP();
I put a break point at the __NOP();
The logic analyzer says the UART1 TX pin did not move at all.
The serial port used to work. I like to use it for debugging. I print messages out to see what is going on when it is running. So it is the first thing I get to work when I bring up a new board. The pinout of the STM32G031K6T and STM32G051K8T are exactly the same and both have USART1 and USART2 to the same pins.
Because the MX does not transition from one chip to another (another bug that will be fixed in another version) I started another project. And am trying to bring it up peripheral by peripheral, and USART1 is the first one. The clocks are setup the same. 64 MHz in both cases.
,
I do not trust the latest MX add-in or anything about it, but I do not see what could cause it not to work even in polling mode.
Thanks,
Solved! Go to Solution.
2022-07-05 06:38 AM
Hello @KiptonM ,
Yes the issue is also fixed in CubeIDE.
Before performing project migration to the latest version v1.10.0 please check this thread first.
Sara.
2022-07-05 06:41 AM
Too late for me. I just updated like the STM32CubeIDE program instructed.