2015-05-06 09:55 AM
Currently in the investigative process of migrating PIC to STM32 I'm pretty early in on the process so go easy on me. My work is mostly CAN but also USB, some switches and LED work.
PWM questions: 1. I see the STM32F1 for instance has 1x 16bit PWM for motor control, 4 counters per timer, 16 timers etc. Are the outputs I can PWM specifically tied to hardware? 2. Or, is it more of a case that I would set a timer, timer3 for example to a specific IO pin then set the scalers and output method to create the PWM? If this is case, can multiple outputs use the same timer / settings while being enabled and disabled separately? (If I wanted to drive 4 LEDs at the same PWM rate but wanted individual control) 3. Or am I way off base and the I can apply specific PWMs to any output pin? IO: 1. It appears a lot of pins are 5V tolerant (or at least 4V+VDD) which is great. But how durable on the pins? How careful do I need to be about ratings vs reality? The PICs I'm used to are very overbuilt in this regard. 2. Does anyone specifically recommend against CMSIS in terms of moduality when dealing with IOs? I've gotten mixed reports on this. 3. Can someone clarify the max mA that the IOs can source? I'm having trouble seeing if they mean to say +/- 25mA for any single IO pin with a max of 150mA for the chip or all 25mA on all IO pins combined? Basic and surely misguided questions I know! Thanks. * If anyone has any futher advice as to parts, toolchains,2015-05-06 10:22 AM
The Data Sheet for the specific parts provides details of what pins can connect to what peripherals.
A single timer can have 4 channels, routed to supported pins. single frequency, different duties. ie One timer can control 4 50Hz (20ms) servos.2015-05-07 03:05 AM
If you are new to STM32 (like me...) then I highly recommend using the utility STM32CubeMX.
It's a great helps for configuring your MCU, select peripherals to be enabled, see the I/O pins assigned to them, and last but not least generate the initialisation code. For the toolchain, at the moment I am using GCC on Raisonance Ride7, and experimenting with CooCox.