AnsweredAssumed Answered

CubeMX USART LL Configuration not Working!

Question asked by Mujtaba Hossaini on Jun 4, 2018
Latest reply on Jun 5, 2018 by Mujtaba Hossaini

Dear friends,

 

I am trying to send 8 bytes over RS485 protocol using LL libraries.

I could achieve sending data using HAL libraries (CubeMX configuration) and

SPL libraries.

 

Now I want to use LL APIs to transmit data. I've used the following code:

 

    DE_SIGNAL_GPIO_Port->BSRR = DE_SIGNAL_Pin;
    
    LL_mDelay(100);
    
    for(j=0;j<8;j++)
    {
        while(!LL_USART_IsActiveFlag_TXE(USART1)){}
        LL_USART_TransmitData8(USART1,snd_buff[j]);
        
    }
    
    while(!LL_USART_IsActiveFlag_TC(USART1)){}
    
        
    DE_SIGNAL_GPIO_Port->BRR = DE_SIGNAL_Pin;

 

The code is not working and no data is transmitted.

 

The SPL counterpart code that works fine is as follow:

 


  GPIOA->BSRR=GPIO_Pin_8;

 

  for(i=0;i<Length+2;i++)
     {
        while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET){}
        USART1->DR = snd_buff[i];
        }
    while(USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET){}

 

    GPIOA->BRR=GPIO_Pin_8;

 

 

I'll be thankful if anyone could help run the USART using LL APIs.

Attachments

Outcomes