[DONE] Small bug in header STM32F4xx/hal_lld.h

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

[DONE] Small bug in header STM32F4xx/hal_lld.h

Post by dismirlian »

Hello, first of all, thank you for providing this excellent OS for free!

I think I've found a bug in the STM32F4xx/hal_lld.h header, namely, in the following code:

Code: Select all

#if (STM32_MCO2SEL == STM32_MCO2SEL_HSI) ||                                 \
    ((STM32_MCO2SEL == STM32_MCO2SEL_PLL) &&                                \
     (STM32_PLLSRC == STM32_PLLSRC_HSI))
#error "HSI not enabled, required by STM32_MCO2SEL"
#endif


The MCO2 doesn't support outputting the HSI clock, so STM32_MCO2SEL_HSI isn't defined (which is correct). The code above checks the value of STM32_MCO2SEL_HSI, which is zero by default (the same value as STM32_MCO2SEL_SYSCLK). Of course, the PLL output can be routed to MCO2, and the PLL can have the HSI as its source, so maybe the code should be modified to:

Code: Select all

#if ((STM32_MCO2SEL == STM32_MCO2SEL_PLL) &&                                \
     (STM32_PLLSRC == STM32_PLLSRC_HSI))
#error "HSI not enabled, required by STM32_MCO2SEL"
#endif


Thanks!

Diego.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Small bug in header STM32F4xx/hal_lld.h

Post by Giovanni »

hi,

Thanks for finding, marking this for review before 2.6.2.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] Small bug in header STM32F4xx/hal_lld.h

Post by Giovanni »

Fixed in repository, bug #447.

Giovanni
Post Reply