I desire to use UART4 to talk to a GPS module over serial communications on an Arduino shield board. To do this I need to use UART4, but it does not appear to be enabled.
I tried to enable the UART4 from the STMCubeMX - it seems to works as for other boards (actually I do not have this one). Probably you need to share more details about the issue you are facing. What have you tried?
Can we try not to put the entire question in the summary.
Make sure STM32L475xx is defined (compiler command line)
Check stm32l475xx.h shows as a dependency (via stm32l4xx.h)
Make sure the pins are properly configured.
The clocks are all enabled.
I've used GPS on the IoT shield, UART4 works.
Using System Workbench for STM32
Add symbol for UART4 to the project.
Now clock stuff seems to be defined.
Question: Do I need to define USE_FULL_LL_DRIVER?
It is referenced in File: stm32l4xx_ll_usart.c
I mimicked the code for the console uart:
static UART_HandleTypeDef gps_uart;
static void GPS_UART_Init(void);
static void GPS_UART_Init(void)
gps_uart.Instance = UART4;
gps_uart.Init.BaudRate = 115200;
gps_uart.Init.WordLength = UART_WORDLENGTH_8B;
gps_uart.Init.StopBits = UART_STOPBITS_1;
gps_uart.Init.Parity = UART_PARITY_NONE;
gps_uart.Init.Mode = UART_MODE_TX_RX;
gps_uart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
gps_uart.Init.OverSampling = UART_OVERSAMPLING_16;
gps_uart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
gps_uart.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
BSP_COM_Init appears to only be defined for COM1.
Question: How to make equivalent changes for UART4?
Question: Do I need to do define UART4 using STM32CubeMX and then copy-paste the initialization code?
The "STM32L475xx" (case sensitive) define drives the selective inclusion of different peripherals and drives the assert() functionality for parameter checking, etc.
As you can see, "STM32L475xx" is defined, however it does not cause UART4 to be enabled.
I used STM32CubeMX to generate initialization files for UART4, and the code compiles, but I have not tested it yet.
>>As you can see, "STM32L475xx" is defined
The views I have here don't show any illustration. Forum is broken.
Using the L4 V1.10.0 code trees here.
The LL template defines STM32L475xx,USE_FULL_LL_DRIVER but I don't see it pull stm32l4xx.h directly, likely thru the stm32l4xx_ll_xyz.h files described in main.h. You'll need to walk the dependencies to see what's being pulled in.
Retrieving data ...