Page 1 of 1

PAL Mode Documentation?

Posted: Sat Jan 04, 2014 3:42 pm
by avrhack
Sorry to post this rant as in general I love ChiBIOS despite being relatively new to it, but I'm really struggling with the PAL driver and specifically the seemingly inconsistent and confusing ways of setting things up.

I'm using an STM32F4 and can easily set it up to use alternate function 9 with and open-drain driver by writing the various registers according to the data sheet.

However that's not remotely portable, so in the spirit of ChiBIOS I'm trying to use the PAL driver, whilst of course appreciating that not all of this is portable to other platforms, specifically the ALTERNATE function, but at least if I use ChiBIOS then it will complain if I change processors to one that doesn't support the specifics I'm trying to do.

Having spent literally hours trawling this forum, reading the source code for the LLD etc. and trying seemingly every combination of the settings, it appears the one that works is to pass "PAL_MODE_ALTERNATE(9) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_OTYPE_OPENDRAIN" to the palSetMode API.

So it's working, but I can't figure out the thought / logic behind this set of naming conventions, nor can I find any sort of documentation that would have gotten me to this point without someone else having asked it in the forum elsewhere and me having found the reply.

Anyone care to comment on how these options are supposed to work in ChiBIOS? They're dead easy in the native data sheet, but by the time they make it through the PAL layer they seem incomprehensible to me at least.

And most importantly is there any documentation apart from the lld.h file that the ChiBIOS manual refers to which is effectively just 'read the source code, stupid'!

As an example, PAL_MODE_ALTERNATE is not mentioned in the documentation as an appropriate mode, but it seems to be a non-platform specific one, whereas PAL_STM32_ are clearly non-portable ones but I can't find them documented anywhere other than the source files......

Re: PAL Mode Documentation?

Posted: Sat Jan 04, 2014 6:21 pm
by Giovanni
Hi,

The PAL_STM32_ are the non-portable ones, PAL_MODE_ are the "portable" ones. What follows to the non portable ones is the name of the registers as you find it in the Reference Manual. Settings are meant to be ORed in order to get the final mode.

All modules are properly documented using Doxygen tags, you can read the source code or produce documentation using Doxygen, just pass all the LLDs belonging to a platform to Doxygen and you get the platform documentation.
Being the device drivers not part of the commercial offering and of heavy maintenance pre-built documentation is no more offered.

Pre-built documentation is available for commercially relevant parts only: kernel, high level HAL and ports.

Giovanni

Re: PAL Mode Documentation?

Posted: Sat Jan 04, 2014 7:02 pm
by avrhack
Understood Giovanni thanks - appreciate all of this is free so I shouldn't be complaining! Just found it difficult to follow the logic on these and was rather frustrated by the API.......