2018-01-11 02:10 PM
I have a Amazon Web Services example (AWS) example running on a STM32L475 Discovery board. I got the example from en.stsw-stm32078.zip and it in the C:\...\st Micro\en.x-cube-aws\STM32CubeExpansion_Cloud_AWS_V1.0.1\Projects\B-L475E-IOT01\Applications\Cloud\AWS directory.
It is working perfectly and all is fine. I need to add external UARTs and I was trying to see how to connect a UART4 and USART4 to the Arduino connector at P0/P1 and PA2/PA3 using UART4 and USART2. the documentation seems to suggest that it is possible but I do not see how to set it up and configure it.
I have tried many things but nothing is working.
I am new to the discovery board and I plan to use all of the devices and interfaces on this for a embedded product. I am already using the debug console for the simple command interface (printf/getc/etc.). I need UART4 and USART2 to connect to an external devices.
The external UART4 and USART2 functionality is a crucial part of the project and cannot proceed with out it. I would greatly appreciate any help you can give.
#stm32l475-discovery-board2018-01-11 04:05 PM
Not used the AWS tree, but have ported the LRWAN stuff onto the L4 IoT board, and used shield connector
The IoT board is somewhat devoid of examples in the HAL tree, for a USART example perhaps look at
Repository\STM32Cube_FW_L4_V1.10.0\Projects\STM32L476G_EVAL\Examples\UART
Repository\STM32Cube_FW_L4_V1.10.0\Projects\STM32L476RG-Nucleo\Examples\UART
Pins and clocks usually get defined in stm32l4xx_hal_msp.c via the HAL_UART_MspInit() call back, crack the huart handle for the peripheral in question so each call instantiates the hardware for each specific UART/USART (ST seems not to differentiate the two at times)
Add your HAL_UART_Init() code with your other initialization, it calls the routine described above. You likely want one handle for each serial port.
Add an IRQ Handler to push back into the HAL, usually parked in stm32l4xx_it.c, if you use the HAL IT forms
void USART2_IRQHandler(void)
{ HAL_UART_IRQHandler(&Usart2Handle);}You'll need DMA IRQ Handlers if you plan on using DMA with your USARTs