2018-06-04 12:54 AM
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.
2018-06-04 01:26 AM
Hello
Hossaini.Mujtaba
, We need some information tohelp you:- Which Hardware board, MCU used?
- Which Firmware and CubeMx version used ?
- Do you have an error message?Could you please share your .ioc file.
With Regards,
Imen
2018-06-04 10:15 PM
Dear Imen,
Thanks for your quick reply.
I've tested the USART LL APIs on both STM32F107RCt6 and STM32F103RCt6 MCUs and the didn't work.
I'm using the latest version of CubeMX and my firmware version is 1.6.0.
I could compile the project successfully without any errors.
I've attached the whole project in my first message.
I'll be really thankful if you could help me find the problem.
Best regards,
Mujtaba