2022-06-10 03:54 AM
STM32CubeIDE Version: 1.9.0
Hal MCU : v1.5.1
Chip: STM32G061C8U6
If you enable USART1 in asynchronous mode for pins PA9 and PA10 the auto generated code incorrectly sets the port to AF0 when it should be AF1 see datasheet table 13 or port.png.
When set to the correct port it transmits but at very low amplitude of a few mv. See scpoe.png
Setting the pins to PB7 and PB8 UART works fine.
How to get it working for pins PA9 and PA10?
Solved! Go to Solution.
2022-06-14 04:11 AM
The issue has been fixed. Two things need to be added.
The GPIO alternative function goes to the wrong port.
/* USER CODE BEGIN USART1_MspInit 0 */
GPIO_InitStruct.Alternate = GPIO_AF1_USART1; // Auto generated code is wrong
/* USER CODE END USART1_MspInit 0 */
Also explicitly disabling the pin remapping
/* USER CODE BEGIN MspInit 1 */
HAL_SYSCFG_EnableRemap(SYSCFG_REMAP_PA11);
HAL_SYSCFG_EnableRemap(SYSCFG_REMAP_PA12);
HAL_SYSCFG_DisableRemap(SYSCFG_REMAP_PA11);
HAL_SYSCFG_DisableRemap(SYSCFG_REMAP_PA12);
/* USER CODE END MspInit 1 */
2022-06-10 04:50 AM
STM32G061C8U6, that's the UFQFPN 48
Make sure the PA11/PA12 (USB) usage of these pins is deconflicted
2022-06-10 05:03 AM
2022-06-10 05:09 AM
> auto generated code incorrectly sets the port to AF0
That's the usual risk of relying on autogenerated code.
> When set to the correct port it transmits but at very low amplitude of a few mv.
Read out and check/post relevant GPIO and SYSCFG registers content.
What hardware is this? Did you measure directly on the pin? Isn't there a bad solder joint? Isn't there something else connected to this pin?
JW
2022-06-10 05:21 AM
Also, don't you have some of the I2C enabled?
JW
2022-06-10 05:25 AM
There is no I2C enabled.
2022-06-14 04:11 AM
The issue has been fixed. Two things need to be added.
The GPIO alternative function goes to the wrong port.
/* USER CODE BEGIN USART1_MspInit 0 */
GPIO_InitStruct.Alternate = GPIO_AF1_USART1; // Auto generated code is wrong
/* USER CODE END USART1_MspInit 0 */
Also explicitly disabling the pin remapping
/* USER CODE BEGIN MspInit 1 */
HAL_SYSCFG_EnableRemap(SYSCFG_REMAP_PA11);
HAL_SYSCFG_EnableRemap(SYSCFG_REMAP_PA12);
HAL_SYSCFG_DisableRemap(SYSCFG_REMAP_PA11);
HAL_SYSCFG_DisableRemap(SYSCFG_REMAP_PA12);
/* USER CODE END MspInit 1 */
2022-06-16 06:27 AM
Hi @NN.2 ,
Thanks for bringing this issue to our attention and also for sharing the solution you found.
I add @Sara BEN HADJ YAHYA here so that she can take care of reporting this issue to STM32CubeMX development team in order to take the corrective actions.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-06-17 01:21 AM
Hello @NN.2 ,
Thanks for your feedback,
This is a known issue and it is already reported to be fixed. I will keep you posted.
Internal ticket number: 119027(This is an internal tracking number and is not accessible or usable by customers).
Sorry for the inconveniences,
Sara.
2022-06-22 06:05 AM
@Sara BEN HADJ YAHYA
Were you able to replicate the issue on your end? Any further progress?