-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32F412Cx USART3 contradiction between CMSIS and HAL #5968
Comments
Thanks for the issue! Is the best fix to switch to the STM repo for st_driver? Would you mind making a PR for it? |
@tannewt I noticed that circuitpython has an archived repo as a submodule I think for the ST drivers. Are archived repo's able to be modified? This is the archived repo: https://github.com/hathach/st_driver I'm not familiar enough with circuitpython yet to say whether it would be feasible to update to ST's latest release... There must have been a reason to point to an archived repo? Although it would be a nice update, it looks like most of the ST stuff in circuitpython is >2 years old. I've seen @hathach 's name around here, maybe he would have some input on that? |
It looks like TinyUSB switch to direct submodules to the ST repos: hathach/tinyusb#544 |
Yeah, we should switch to official st repo which is only available recently. The st_driver repo is created way before that. |
I opened a PR to make this change #5976 |
PR #5976 was merged which fixes this issue. |
CircuitPython version
Code/REPL
None
Behavior
I am adding a board to CircuitPython with a STM32F412CG micro on the board. I ran into an error while building CircuitPython about USART3 functions:
common-hal/busio/UART.c: In function 'uart_clock_enable':
common-hal/busio/UART.c:484:9: error: implicit declaration of function '__HAL_RCC_USART3_FORCE_RESET' [-Werror=implicit-function-declaration]
484 | __HAL_RCC_USART3_FORCE_RESET();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
common-hal/busio/UART.c:484:9: error: nested extern declaration of '__HAL_RCC_USART3_FORCE_RESET' [-Werror=nested-externs]
common-hal/busio/UART.c:485:9: error: implicit declaration of function '__HAL_RCC_USART3_RELEASE_RESET' [-Werror=implicit-function-declaration]
485 | __HAL_RCC_USART3_RELEASE_RESET();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common-hal/busio/UART.c:485:9: error: nested extern declaration of '__HAL_RCC_USART3_RELEASE_RESET' [-Werror=nested-externs]
common-hal/busio/UART.c:486:9: error: implicit declaration of function '__HAL_RCC_USART3_CLK_ENABLE' [-Werror=implicit-function-declaration]
486 | __HAL_RCC_USART3_CLK_ENABLE();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
common-hal/busio/UART.c:486:9: error: nested extern declaration of '__HAL_RCC_USART3_CLK_ENABLE' [-Werror=nested-extern
]
common-hal/busio/UART.c: In function 'uart_clock_disable':
common-hal/busio/UART.c:559:9: error: implicit declaration of function '__HAL_RCC_USART3_CLK_DISABLE' [-Werror=implicit-function-declaration]
559 | __HAL_RCC_USART3_CLK_DISABLE();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
common-hal/busio/UART.c:559:9: error: nested extern declaration of '__HAL_RCC_USART3_CLK_DISABLE' [-Werror=nested-externs]
Description
See STMicroelectronics/STM32CubeF4#42
In CMSIS/Device/ST/STM32F4xx/Include/stm32f412cx
USART3_BASE
is defined.In STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h, USART3 functions are not defined for STM32F412Cx.
https://github.com/hathach/st_driver/blob/1900834751fd6754457874b8c971690bab33e0a7/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h#L4972-L4973
So that causes issues when common-hal/busio/UART.c sees USART3 as defined but can't find the functions for USART3.
The fix ST applied to their repo was to remove all of the #ifdef's for all USART3 define's in stm32f4xx_hal_rcc_ex.h. USART3 is available on the STM32F412CG, but only as half-duplex. See Table 2 note 2 in the STM32F412CG datasheet.
Additional information
No response
The text was updated successfully, but these errors were encountered: