Sorry for the delay. Last week was unexpectedly very busy work wise, and I didn’t get back to SimpleFOC until this weekend.
I now have 6-PWM working, both in hardware mode and software…
Here’s where I’m at:
- 6-PWM can only be supported on the TCC units. I can’t think of a practical way to make the much weaker TC units sync up sufficiently precisely to get workable dead-time insertion from software. If anyone has ideas for this, they’re welcome.
- Hardware Dead-time-insersion can work if the high and the low pin are on the same TCC unit and channel, but different outputs (WOs).
- Software Dead-time-insertion can work if the high and the low pin are on the same TCC unit but different channels.
- Hardware and Software DTI have identical timings
In this picture, D0=pinA_h, D1=pinA_l, D2=pinB_h, D3=pinB_l, D4=pinC_h and D5=pinC_l
pinA_h/pinA_l are using software-DTI, while the others are using hardware-DTI.
As usual, there is a small problem:
Hardware Dead-Time-Insertion needs to be set up at init-time, not during each update. So really I need the value of the “deadzone” parameter at init-time …
@Antun_Skuric is there any reason it is passed to the writeDutyCycle() methods rather than the configure() methods? Could we add it to the configure methods?
And could it be removed from the writeDutyCycle() methods? It seems to me that the value would be related to the MOSFETs used, and thus loop-invariant?
However, it seems SAMD would support separate values for High-Side and Low-Side dead-time (reflecting the fact that rise and fall times of the MOSFETs could be quite different)… would we want to support that?
Otherwise, I think I’m close to done. I still need to:
- Clean up the code, remove debugs
- See if I can get double buffering to work (so far no luck)
- Test 6-PWM with a motor (so far only looking at the PWM waveforms)
- Handle the dead-time issue mentionsd above
- Write some docs