Skip to main content
MMath.10
Associate III
January 24, 2019
Solved

STM32L0 UART on b-l072z-lrwan1

  • January 24, 2019
  • 4 replies
  • 4158 views

Hi,

I use the b-l072z-lrwan1 to make lora advertisment and it's work.

I use the project AT_slave or END_Node.

But i want to use the second uart USART1 and nothing work in the environment.

If i just change the file B-L072Z-LRWAN1\Applications\LoRa\End_Node\Core\inc\mlm32l0xx_hw_conf

The program launch but nothing appear on the UART.

I make a project with 2 UART with STM32CubeMX and both work great (it's not a hardware problem)

Someone could help me?

This topic has been closed for replies.
Best answer by Tesla DeLorean

USART1 is REQUEST 3, Channel 2 or 4, check also hard references in VCOM.C

/* 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

4 replies

Tesla DeLorean
Guru
January 24, 2019

USART1 is REQUEST 3, Channel 2 or 4, check also hard references in VCOM.C

/* 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

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MMath.10
MMath.10Author
Associate III
January 25, 2019

Thanks for your reply.

Do you have a link to a doc wich explain these configuration?

What i want is USART1 in standard output

In a second time i want USART2 in TXRX mode without DMA.

USART1 work with channel 4 but not with channel 2

"

/* Definition for USARTx's DMA */

#define USARTx_TX_DMA_CHANNEL       DMA1_Channel4

"

Tesla DeLorean
Guru
January 28, 2019

Try pulling the Reference Manual for the L072 part.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MMath.10
MMath.10Author
Associate III
January 25, 2019

Thanks for the first correction,

So now, I want my USART1 to work again.

I modify only vcom.c.

"

 //status = HAL_UART_Init(&UartHandle1);

"

If i do not init my USART, everything works, otherwise only the first message appear on USART2.

Any idea?

MMath.10
MMath.10Author
Associate III
January 28, 2019

Up for this question

@Community member​ 

Do you prefer that I open a new subject?

Tesla DeLorean
Guru
January 28, 2019

One person with interrelated topics, best kept in single thread.​

Many hours behind you, will check later.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MMath.10
MMath.10Author
Associate III
January 29, 2019

@Community member​ 

Do you have an idea where a can found a project with lora installed and 2 USART 115200?

When i change the baudrate in AT_slave project, the RX part stop working...

Tesla DeLorean
Guru
January 29, 2019

My application with the Murata module uses multiple USART, I have no specific need to port the AT_Slave application. Getting a working port built and tested would take some time/effort. You might need to refactor the code to deal with high baud rates, and timeouts associated with the LoRa stack.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MMath.10
MMath.10Author
Associate III
January 31, 2019

I already tried to start from a fresh project.

The USART work well but incorporate the lora stack is not so easy....

My prototype will be ready next week, so i have to go forward and i use the program AT_slave with 9600baud...

I have no specific need of the AT_slave application too. But i need a project with a functionnal UART in full duplex mode and lora stack...

MMath.10
MMath.10Author
Associate III
February 5, 2019

Hi @Community member​ ,

I'm not really happy with my CubeMX project because Lora does not work very well ...

So get back with EndNode project.

Lora is OK

I have TX and RX on UART2 at 115200 !!

But when i tried to initialize USART1

// if(HAL_UART_Init(&huart1) != HAL_OK)

// {

//  /* Initialization Error */

//  Error_Handler();

// }

My USART_2 gState still locked in HAL_UART_STATE_BUSY_TX mode.

I don't understand where the default is.

I only change this comment lign and USART2 stop working.

The DMA not release the gState in READY mode...

Do you have an idea?

MMath.10
MMath.10Author
Associate III
February 14, 2019

the solution is found :

HAL_UART_MspInit and HAL_UART_MspDeInit shall be separated depending on wich huart called.

void HAL_UART_MspInit(UART_HandleTypeDef *huart)

{

 static DMA_HandleTypeDef hdma_tx;

 if(huart->Instance==USART1)

 {

 __USART1_CLK_ENABLE();

 __GPIOA_CLK_ENABLE();

 vcomh1_IoInit();

 //HAL_NVIC_SetPriority(USART1_IRQn, USARTx_DMA_Priority, 1);

 //HAL_NVIC_EnableIRQ(USART1_IRQn);

 }

 else

 {

void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)

{

 if(huart->Instance==USART1)

 {

  vcomh1_IoDeInit( );

  __USART1_FORCE_RESET();

  __USART1_RELEASE_RESET();

 }

Regards