Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 2 months ago.
Alternative pwm pins
Hi,
For my project, I use a NUCLEO F446RE. I want to use PWM_11 to PWM_14 because the other timers are already occupied for encoder input capturing. In the mbed-src file (https://os.mbed.com/users/mbed_official/code/mbed-src/file/a11c0372f0ba/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F446RE/PeripheralPins.c), the pinpap for these pwm channels are commented because it are alternative possibilities. It says: "If you change them, you will have also to modify the corresponding xxx_api.c file for pwmout, analogin, analogout, ...". But where can I find this file and how do I change it?
Thanks Ward
2 Answers
7 years, 2 months ago.
The sources for mbed are here: https://github.com/ARMmbed/mbed-os There are lots of topics on how to do this. Take a look through the sources listed and see if you have further questions. Most of the templates for expanding features are in place.
Hi Bill, Thanks for the answer. If I import this library to the online mbed compiler, I could not open the PeripheralPins.c file. If I only copy the PeripheralPins.c file, it gives as error: "Symbol ... is multiply defined by PeripheralPins.o". What is the right way to do this? I am sorry if this is a stupid question.
posted by 04 Oct 2017I'm not sure if you can change the mbed-os sources in online compiler. Give Mbed CLI a try, it will work.
posted by 05 Oct 20177 years, 2 months ago.
For example if you want to use PWM_11 (instead of PWM_4) on PB_9, you have to do this in the PeripheralPins.c file:
// {PB_9, PWM_4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 {PB_9, PWM_11,STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11,1, 0)}, // TIM11_CH1
It should be enough.
The Note in the header is obsolete and will be changed.
Hi Ward In order to "customize" mbed you will need to do the following assuming you are doing cloud based builds.
Hope that helps Bill
posted by Bill Bellis 05 Oct 2017It is not possible to open the file in the online compiler, but I exported the program to an offline compiler. This way it works. Thanks a lot!
posted by Ward Vandenbroucke 05 Oct 2017It works just fine. You must not have followed the instructions exactly. When you import the URL of your forked repository (not the mbed one, but YOUR fork) you can edit away. And I only use the online build - never have done CLI.
posted by Bill Bellis 05 Oct 2017Nice tip about the forking Bill!
posted by Jan Jongboom 06 Oct 2017