Building 2.4.0 with PWM enabled

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
rallysjd
Posts: 15
Joined: Mon Jan 16, 2012 4:17 pm

Building 2.4.0 with PWM enabled

Post by rallysjd »

Hello Giovanni,
We have updated to 2.4.0 from 2.3.4, and have it running on a Decaf-2 (STM32F103VE) board
Image
with our LCD, graphics and Font library functions. The key matrix functions with the EXT driver and runs a set of graphics tests.

When we update halconf.h to enable HAL_USE_PWM and
STM32_PWM_USE_TIM1 in mcuconf.h we get build errors:

build/obj/pwm_lld.o: In function `VectorA4':
G:\ChiBIOS RTOS\ChibiOS_2.4.0\demos\ARMCM3-STM32F103/../../os/hal/platforms/STM32/pwm_lld.c:149: multiple definition of `VectorA4'
build/obj/gpt_lld.o:G:\ChiBIOS RTOS\ChibiOS_2.4.0\demos\ARMCM3-STM32F103/../../os/hal/platforms/STM32/gpt_lld.c:108: first defined here

I see
..\..\..\os\hal\platforms\STM32F1xx\hal_lld_f103.h
825 #define TIM1_UP_IRQHandler VectorA4 /**< TIM1 Update. */

There's the vectors[] array in os\ports\GCC\ARMCMx\STM32F1xx\vectors.c where VectorA4 is declared.

Enabling TIM2 instead of TIM1 results in the same error on VectorB0, which was expected.

After quite a bit of digging in the code, I don't see what is causing the problem.

If in mcuconf.h I disable TIM1-5, and use
#define STM32_PWM_USE_ADVANCED TRUE and
#define STM32_PWM_USE_TIM8 TRUE

2.4.0 builds with no errors.

Can you clarify what's happing here?


Minor Doc Bug Report.
Running Doxygen to build HTML files creates a chibiOS doc set with id or 2.3.5, not 2.4.0. Doxyfile_html lists the project as 2.4.0, so the bug is somewhere else. I did not search for it, just set 2.4.0 from 2.3.5 in the generated HTML.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Building 2.4.0 with PWM enabled

Post by Giovanni »

Hi,

The GPT, ICU and PWM drivers share the TIMx units of the STM32, this means that if you assign TIM1 to GPTD1 you can't assign it also to PWMD1 or you would get that conflict on ISR vector.

The assignment of the TIMx units to the drivers is done in mcuconf.h. If in doubt post your mcuconf.h here.

Giovanni
rallysjd
Posts: 15
Joined: Mon Jan 16, 2012 4:17 pm

Re: Building 2.4.0 with PWM enabled

Post by rallysjd »

Different TIMs for each device: that makes sense, thanks.

On a related issue, I also enabled MAC, and had to add mac_lld.c + .h templates to platforms/STM32 and update the platform.mk file. 2.4.0 now builds, but of course the mac_lld files require updating with the specifics of my boards.

I'd like to create an article for the Forum on porting chibiOS to the Decaf boards, and probably include integrating lwip1.4. How would this be handled on your end? Create a new Board Index entry for user docs?

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

Re: Building 2.4.0 with PWM enabled

Post by Giovanni »

Hi,

Note that there isn't yet a native MAC driver for the STM32, there is contributed wrapper on the ST library, there is a thread in the development forum.

I could create a new forum for user's guides or I could just rename "Code Samples" in "User Contributions" or something like that. Alternatively I could open a user section on the web site wiki.

Giovanni
rallysjd
Posts: 15
Joined: Mon Jan 16, 2012 4:17 pm

Re: Building 2.4.0 with PWM enabled

Post by rallysjd »

Giovanni wrote:Hi,
I could create a new forum for user's guides ... a user section on the web site wiki.
Giovanni


Certainly I'm happy to contribute to such a well written project.

I think that a new forum (rather than a wiki entry) would be preferable, as code samples are just that, while a user "how to" article can be expected to be more detailed. I think that such articles should be editable by the author (and you of course) only, in much the way that Wiki articles can be, with readers able to comment, perhaps into a sub forum. Comments could and often would result in an article update. I suggest this so that a "how to" article is always visible at the top a message/thread, and can always be assumed to be the most recent and up to date.

My first suggestion is a Getting Started / Porting guide, and would encapsulate what we did here to get up to speed with chibiOS. The Doxygen DOCs are very nice and quite complete with How and What details, but rather thin on Why, Where and When issues.

Another possible article is building and using the Win simulator (we are a Windows dev house, and moving into Linux).
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Building 2.4.0 with PWM enabled

Post by Giovanni »

OK, when it is done I will create another subforum and move the thread there.

Giovanni
Post Reply