Skip to main content
SARTHAK KELAPURE
Associate III
Dec 16, 2017 4:53 AM UTC
Solved

Problem with UART and LL drivers

Posted on December 16, 2017 at 05:53

Hello everyone, this is a problem regarding my DISCO-L072CZ-LRWAN kit which I am using for a project of mine.

I am using the LRWAN expansion kit for LoRa functionality while I am also trying to add up a UART as UART1 on Pin 9/10. While using this UART, I am trying to use the HAL drivers especially HAL_UART_Receive function which receives N number of character and has a timeout given by the user which I am giving as 0x00FF. Internally this function takes sysTick using Get_HAL_Tick() but as the LoRa function has initialized all LL drivers, the getting systick function from HAL does not work. Which means that there will be no timeout and I have to specify the number of characters to be received, which is bizarre.

I hope you understood my problem. Please try and help with solution or any other alternative.

If you have any solution for UART which solves this problem please reply.

#b-l072z-lrwan1 #b-l072z-lrwan1
This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Dec 16, 2017 4:39 PM UTC
Posted on December 16, 2017 at 17:39

The LRWAN implementation uses the RTC over SysTick, but it is possible to implement/enable SysTick if you need/want to.

Unless you've got a bunch of experience I wouldn't try to mix HAL and LL stuff up to much. I would strongly recommend reading the Reference Manuals so you know how the underlying hardware works as this will provide a lot of clarity about what the software needs to do.

The LRWAN/VCOM implementation is a bit of a mess, there is a lot of blocking code compounded by the way the CM0+ NVIC works. I ended up reworking most of that code to use the status and data registers more directly, and providing some more effective FIFO buffering via the IRQ Handlers.

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

4 replies

S.Ma
Principal
Dec 16, 2017 6:18 AM UTC
Posted on December 16, 2017 at 07:18

Either go to debug mode to figure out how to cascade the Systick interrupt to all functions needing them, or use a simple unused STM32 Timer to build a programmable timeout event that you use in your main loop to abort UART (ie: Make your own timeout).

Andrew Neil
Super User
Dec 16, 2017 12:35 PM UTC
Posted on December 16, 2017 at 13:35

SARTHAK KELAPURE wrote:

I am trying to use the HAL drivers especially HAL_UART_Receive function

But your thread title says LL Drivers - so which is it?

Do you actually need the timeout?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Dec 16, 2017 4:39 PM UTC
Posted on December 16, 2017 at 17:39

The LRWAN implementation uses the RTC over SysTick, but it is possible to implement/enable SysTick if you need/want to.

Unless you've got a bunch of experience I wouldn't try to mix HAL and LL stuff up to much. I would strongly recommend reading the Reference Manuals so you know how the underlying hardware works as this will provide a lot of clarity about what the software needs to do.

The LRWAN/VCOM implementation is a bit of a mess, there is a lot of blocking code compounded by the way the CM0+ NVIC works. I ended up reworking most of that code to use the status and data registers more directly, and providing some more effective FIFO buffering via the IRQ Handlers.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
SARTHAK KELAPURE
Associate III
Dec 19, 2017 6:45 AM UTC
Posted on December 19, 2017 at 06:45

Well thank you. I ended up mixing the HAL and LL drivers and it works as of now. Even I am going to remake vcom.c again. Thank you.