Need of 9 PWM Outputs on Olimex A20 micro

Started by wapel, January 25, 2015, 05:52:17 PM

Previous topic - Next topic

wapel

Hello.
Hope to get some tips what is the best way to get 9 PWM Outputs on my Olimex A20 Micro with Debian.
I want to control some FETs for charge and discharge channels in a accu charger.+ fan control.
I want to have PWM frequency >15KHz because of noises.

-Two Hardware PWM are onboard --> Missing 7
-Could extend with I2C Breakout Board. For Example with PCA9685 --> Problem is only max 1KHz PWM Frequency.
-Could extend with avr board with PWM and i2c. --> Additional Software, more hardware.
-Software PWM --> I know Debian is no RTOS. I want to try this. Is there some good c code i can use ?

Thanks for some ideas to find optimal way.

Marc

MBR

I reccomend the last one.

You can compile your own kernel with realtime support (you will have to use patches), but as long as your application will be the only one non-kernel process running on the A20 with realtime priority, you probably don't have to. If you desing your hardware to be fault-tolerant (e.g. all PWM inputs will have some pulse lenght-limiting circuitry), you don't have to use realtime kernel, but you will have to get rid all unecessary processes. I recommend to build you custom image, with Busybox as init/commands/shell/whatever and your battery charger apllication as sole runnning non-kernel process with realtime priority. You are just charging batteries, not controling a spaceship :-)

The C code could be very simple: turn the pin on, wait, turn the pin off, wait. You can run mutliple pins in one cycle (a bit complicated, but it can be done) or dedicate one thread for each battery (because you will never charge and discharge at the same time), with the main thread as control.

PS: I you want graphics output, I recomend to use the framebuffer instead of XServer.