Page 1 of 1

Manual PAL init?

Posted: Wed Apr 08, 2015 3:02 pm
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

Re: Manual PAL init?

Posted: Wed Apr 08, 2015 4:03 pm
by Giovanni
palInit() should be safe but I never tried it.

Giovanni

Re: Manual PAL init?

Posted: Wed Apr 08, 2015 4:29 pm
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!

Re: Manual PAL init?

Posted: Wed Apr 08, 2015 4:42 pm
by Giovanni
PAL clocks are never disabled once activated.

Giovanni

Re: Manual PAL init?

Posted: Thu Apr 09, 2015 9:35 am
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.

Re: Manual PAL init?

Posted: Thu Apr 09, 2015 10:52 am
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