Using the built-in PWM module on the S12C

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Post Reply
KGB
Experienced MS/Extra'er
Posts: 272
Joined: Mon Oct 03, 2005 11:26 pm
Location: Delta, BC, Canada

Using the built-in PWM module on the S12C

Post by KGB »

Other than the fact that you might have proven software PWM code, any limitation on using the hardware PWM instead? Just trying gauge the flexibility of the S12C chip on a 48pin setup
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Post by jsmcortina »

Hardware PWM is nice.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
KGB
Experienced MS/Extra'er
Posts: 272
Joined: Mon Oct 03, 2005 11:26 pm
Location: Delta, BC, Canada

Post by KGB »

Well, you're limited to the bus clock scalers, and with the 48 pin C64, PWM will go thru the first 5 pins of the timer channels, plus Port P5 which is currently used by the bootloader jumper. That's 8 bit PWM - go 16 bit, you're left with P5, T3 and T1 as PWM. Not as flexible, but should be a lot less work.

The firmware as its written for MS2, how extensive it would be to move the pins around (like moving the triggers to a different Timer port to free up the PWM ports)? I seriously think that we should look at a variant of MicroSquirt, just re-arrange the pins, and add the extra circuits. Now of course, I can't do that....
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Post by jsmcortina »

Because the timer input capture pins share the same pin as PWM you are somewhat scuppered. If you move to a larger pinout version of the same family you can access the PWM and IOC pins at the same time.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
KGB
Experienced MS/Extra'er
Posts: 272
Joined: Mon Oct 03, 2005 11:26 pm
Location: Delta, BC, Canada

Post by KGB »

My thoughts follow: you can selectively route the pins to either a timer or the PWM, and in 16 bit mode, you can only have 3 PWM output anyway (T1, T3, P5). Currently the bootloader jumper occupies P5 (which can be configured as GPIO or PWM), while the rest share pins with the timer. I guess it all depends on how many PWM output we want to provide (Idle & Boost Control in the current feature set) - by moving the triggers and injectors to the lower priority timers, you can now have a choice. The minimum configuration for timer usage is 2 injector channels and 1 trigger, and for a typical 4 cylinder sequential setup requires 2 triggers + 4 injector channels you can still have up 3 PWM output.

The GPIO board is almost perfect for MS2/Extra if we can find out how to make some of those VB921 circuits drive injectors instead of ignition
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Post by racingmini_mtl »

Unless you change the bootloader, you can't use P5. That's not a big change to do in the bootloader code but you need a BDM to change the code on the chip.

If you use external injector drivers such as my p&h board, you can just remove the VB921 and use the cpu signal to drive the injector driver.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Post Reply