Manual PAL init?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Manual PAL init?

Post by Korken »

Hi all,

During the start of my MCU I need to read a pin's value to determine whether I should enter a bootloader or not.
And the thing is that I want to check this during the __early_init() phase.
To do this I'd like to use the PAL part of the HAL (to keep it all HW independent), but it is not initialized yet.

Is it safe to do a manual palInit() and do the check before all clocks are configured and so on?
I cannot find what limits ChibiOS puts on this.

Thanks for any clarification!

Best Regards
Emil
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Manual PAL init?

Post by Giovanni »

palInit() should be safe but I never tried it.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Manual PAL init?

Post by Korken »

Thanks for the answer!

I have tried it and it seems to work, but I noticed that compared to the rest of the HAL it is missing a stop or deinit function?
Is there some generic way to disable the clocks that the PAL has enabled?

Thanks!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Manual PAL init?

Post by Giovanni »

PAL clocks are never disabled once activated.

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: Manual PAL init?

Post by Korken »

Okey! I will have to get my own solution there then.

Is there any generic clock management in ChibiOS?
I have been searching the files and documentation, but I cannot find anything.
My guess is that something like that would be too platform specific.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Manual PAL init?

Post by Giovanni »

It is the RCC module in the various STM32 sub-platforms. It is not an API, just a support module for the STM32 HAL.

Giovanni
Post Reply