Author Topic: STM32 HRTIM dead-time generator breaks with fast (async) external event mode  (Read 2091 times)

0 Members and 1 Guest are viewing this topic.

Offline uer166Topic starter

  • Frequent Contributor
  • **
  • Posts: 893
  • Country: us
Well, there goes my detailed post, eaten up by a forum bug. Anyway, has anyone used the dead-time generator in HRTIM here? I have a quick-and-dirty hysteretic constant current controller with 2 comparators and 2 DACs, feeding the HRTIM events EEV1 and EEV4. The HRTIM timer A outputs are set to be complementary with dead-time.

Now, the relevant dead-time setup code is:
Code: [Select]
pDeadTimeCfg.Prescaler = HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8;
  pDeadTimeCfg.RisingValue = 511;
  pDeadTimeCfg.RisingSign = HRTIM_TIMDEADTIME_RISINGSIGN_POSITIVE;
  pDeadTimeCfg.RisingLock = HRTIM_TIMDEADTIME_RISINGLOCK_READONLY;
  pDeadTimeCfg.RisingSignLock = HRTIM_TIMDEADTIME_RISINGSIGNLOCK_WRITE;
  pDeadTimeCfg.FallingValue = 511;
  pDeadTimeCfg.FallingSign = HRTIM_TIMDEADTIME_FALLINGSIGN_POSITIVE;
  pDeadTimeCfg.FallingLock = HRTIM_TIMDEADTIME_FALLINGLOCK_READONLY;
  pDeadTimeCfg.FallingSignLock = HRTIM_TIMDEADTIME_FALLINGSIGNLOCK_WRITE;
  if (HAL_HRTIM_DeadTimeConfig(&hhrtim1, HRTIM_TIMERINDEX_TIMER_A, &pDeadTimeCfg) != HAL_OK)
  {
    Error_Handler();
  }

This is almost exactly the same as ST's synchronous buck example. Above didn't work initially and caused some waveform overlap on the falling edge, see the attached screenshot. If I replaced this:
Code: [Select]
pEventCfg.FastMode = HRTIM_EVENTFASTMODE_ENABLE;With this:
Code: [Select]
pEventCfg.FastMode = HRTIM_EVENTFASTMODE_DISABLE;Suddenly it worked as expected.

I realize there are limitation in using async inputs, but I am unable to find anything relating lack of dead-time generation and using external events asynchronously in the reference manual. So, anyone has any ideas? I would like my inputs to not have the 6-7 clock re-synchronization latency, if at all possible.
« Last Edit: November 06, 2020, 04:02:58 am by uer166 »
 

Offline Miyuki

  • Frequent Contributor
  • **
  • Posts: 907
  • Country: cz
    • Me on youtube
Why just not use two timers and generate signal with delay at leading edge?
I don't say it is a clean solution, but can be much easier to debug.

At event 1
1st timer start with leading edge delay
2nd timer stop instantly

At event 2
2nd timer start with leading edge delay
1st timer stop instantly
 

Offline uer166Topic starter

  • Frequent Contributor
  • **
  • Posts: 893
  • Country: us
That's another way to achieve same result with twice the resources. If a feature is available that I like, it should be possible to use it  :-//

The HRTIM seems one of the more badly documented IPs. A lot of words, yet not enough detail.
 

Offline uer166Topic starter

  • Frequent Contributor
  • **
  • Posts: 893
  • Country: us
Some other potentially fatal issue found, when initially preloading/forcing the output to be in a certain state via
Code: [Select]
hhrtim1.Instance->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].RSTx1R = HRTIM_RST1R_SRTAs per reference manual.

For whatever reason, it makes it insensitive to the real external events it's supposed to switch on, ignoring comparator outputs and such. It's almost as if the initial output set or reset did something to the original set/reset crossbar configuration. Is there an errata for this POS peripheral somewhere? With so much complexity, it for sure has at least one problem, bit neither the MCU errata, nor searching yields one.
« Last Edit: November 08, 2020, 03:03:55 am by uer166 »
 

Offline nuclearcat

  • Supporter
  • ****
  • Posts: 382
  • Country: lb
You didn't mentioned yet specific STM32 model you are using.
 

Offline uer166Topic starter

  • Frequent Contributor
  • **
  • Posts: 893
  • Country: us
Sorry that would be STM32G474.
 
The following users thanked this post: nuclearcat

Offline sanmu

  • Newbie
  • Posts: 1
  • Country: hk
hello,I encountered the same problem as you,can you tell me how you solved this problem? i need fast (async) external event mode to control a current controlled high frequency converter
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf