STM32L0/L4 LPUART support

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
vrollei
Posts: 70
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 2 times

STM32L0/L4 LPUART support

Postby vrollei » Tue Sep 12, 2017 12:09 pm

Hi,

updated ChibiOS 17.6.0 USARTv2 driver with STM32L0/L4 LPUART support is attached.
Is it possible to review and merge?
Attachments
lpuart.tar.gz
(14.35 KiB) Downloaded 4 times
Vitaly

User avatar
Giovanni
Site Admin
Posts: 10203
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 212 times
Been thanked: 193 times
Contact:

Re: STM32L0/L4 LPUART support

Postby Giovanni » Tue Sep 12, 2017 12:28 pm

Thanks.

Weekend task.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 10203
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 212 times
Been thanked: 193 times
Contact:

Re: STM32L0/L4 LPUART support

Postby Giovanni » Sun Sep 24, 2017 4:03 pm

Hi,

The patch is not aligned with trunk, the real problem is that it uses 64 bits arithmetic in usart_start(), is this really required?

Also, all mcuconf.h files should be aligned with the new settings.

Giovanni

vrollei
Posts: 70
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 2 times

Re: STM32L0/L4 LPUART support

Postby vrollei » Sun Sep 24, 2017 6:02 pm

Hi,

64-bit part is completely the same as in hal_serial.c:
#if STM32_SERIAL_USE_LPUART1
if ( sdp == &LPSD1 )
{
u->BRR = (uint32_t)( ( (uint64_t)sdp->clock * 256 ) / config->speed);
}
else
#endif

if it is a problem, will try to do it only with uint32_t.

mcuconf.h files should be aligned: do you mean to define STM32_HAS_LPUART1 in all stm32_registry.h?
Vitaly

User avatar
Giovanni
Site Admin
Posts: 10203
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 212 times
Been thanked: 193 times
Contact:

Re: STM32L0/L4 LPUART support

Postby Giovanni » Sun Sep 24, 2017 6:10 pm

I have not noticed it in the serial driver... thanks for pointing that out. If you find a 32bits-only solution then I will apply it also on the serial driver, if not then let's keep the 64 bits arithmetics.

Correct, all registry files have to be updated and have those keys to FALSE. All L4 mcuconf.h files have to be updated too but we are in the middle of huge HAL changes so that will be done at the end, no need to do this now.

Giovanni

vrollei
Posts: 70
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 2 times

Re: STM32L0/L4 LPUART support

Postby vrollei » Mon Sep 25, 2017 3:47 pm

Hi,

STM32_HAS_LPUART1 macro set in all stm32_registry.h files already, so there is no reason to change it again, we need just merge l0/l4 registry file with new LPUART macros and hal_uart_lld

I would suggest this solution for 32bits only arithmetic:

Code: Select all

if sdp->clock <= 0xFFFFFF then
   BRR = (sdp->clock * 256 ) / config->speed
else
   BRR = ((sdp->clock / 100) * 256 ) / (config->speed / 100)
Vitaly


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 1 guest