cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change the UART2 for the UART1 in pin A9 and A10 in the example of ping pong in the STM32 cube expansion LRWAN?

oharo.1
Associate II
 
7 REPLIES 7

Yes

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
oharo.1
Associate II

.

Can you tell me what files I must change to have the communication?:grinning_face_with_sweat:

You don't mention a board, but typically the builds have an xyz_hw_conf.h type file, and that addresses 95% of things that need definitions changed. Might need to chase down an interrupt handler and GPIO_AF​ setting, or double check them.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

ok, I use B-L072Z, I had seen the pin configuration for usart2 but when modifying the pins and functions so that they remain in usart1 on pin 9a and 10a, when uploading the program to the card the com port leaves to transmit data, I don't know what I missing

STM32CubeExpansion_LRWAN_V1.3.1\Projects\B-L072Z-LRWAN1\Applications\LoRa\PingPong\Core\inc\mlm32l0xx_hw_conf.h

...
/* --------------------------- USART HW definition -------------------------------*/
#define USARTx                           USART2
#define USARTx_CLK_ENABLE()              __USART2_CLK_ENABLE();
#define USARTx_RX_GPIO_CLK_ENABLE()      __GPIOA_CLK_ENABLE()
#define USARTx_TX_GPIO_CLK_ENABLE()      __GPIOA_CLK_ENABLE()
#define DMAx_CLK_ENABLE()                __HAL_RCC_DMA1_CLK_ENABLE()
 
#define USARTx_FORCE_RESET()             __USART2_FORCE_RESET()
#define USARTx_RELEASE_RESET()           __USART2_RELEASE_RESET()
 
 
#define USARTx_TX_PIN                  GPIO_PIN_2
#define USARTx_TX_GPIO_PORT            GPIOA
#define USARTx_TX_AF                   GPIO_AF4_USART2
#define USARTx_RX_PIN                  GPIO_PIN_3
#define USARTx_RX_GPIO_PORT            GPIOA
#define USARTx_RX_AF                   GPIO_AF4_USART2
 
/* Definition for USARTx's NVIC */
#define USARTx_IRQn                      USART2_IRQn
#define USARTx_IRQHandler                USART2_IRQHandler
 
/* Definition for USARTx's DMA */
#define USARTx_TX_DMA_CHANNEL             DMA1_Channel7
 
/* Definition for USARTx's DMA Request */
#define USARTx_TX_DMA_REQUEST             DMA_REQUEST_4
 
/* Definition for USARTx's NVIC */
#define USARTx_DMA_TX_IRQn                DMA1_Channel4_5_6_7_IRQn
#define USARTx_DMA_TX_IRQHandler          DMA1_Channel4_5_6_7_IRQHandler
 
#define USARTx_Priority 0
#define USARTx_DMA_Priority 0
...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

>>I don't know what I missing

Would suggest doing grep / find-in-file

USART1

USART2

USARTx

Confirm you've identified ALL use cases, things are mapped to USARTx naming

That the interrupts, DMA, and assorted references point to USART1 compatible resources.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..