cancel
Showing results for 
Search instead for 
Did you mean: 

[SPC58Nxx] GTM 344 and TOMs granuliarity?

CoolMo
Associate III

Hallo Everyone,

If I setup two TOM channels with the TOM module clocked at 100MHz: (10nSec)

  • GTM clocked at 100MHz
  • CMD.CFGU.EN_CLK0 = true
  • CMD.CFGU.CLK_DIV0 = 1
  • TOM0 module enabled
  • TOM0_4 source clock = CMU_FXCLK0
  • TOM0_4 period = 10000
  • TOM0_4 duty = 5000
  • TOM0_3 source clock = CMU_FXCLK0
  • TOM0_3 period = 10000
  • TOM0_3 duty = 4800

[EDIT]

Use an oscilloscope with sufficient speed and sampling buffer.

I was using a rough tool which was not allowing me to see into deep.

This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
CoolMo
Associate III

btw: the code to verify this is trivial:

int main(void) {

 const uint32_t period = 10000U;

 uint32_t duty_tom3 = 4200U;

 uint32_t duty_tom4 = 5000U;

 /* Initialization of all the imported components in the order specified in

   the application wizard. The function is generated automatically.*/

 componentsInit();

 /* Uncomment the below routine to Enable Interrupts. */

 /* irqIsrEnable(); */

 GTM_TOMDriver *pTom = &TOMD1;

 gtm_tomSetCompareReg1(pTom, TOM_CHANNEL3, period);

 gtm_tomSetCompareReg2(pTom, TOM_CHANNEL3, duty_tom3);

 gtm_tomSetCompareReg1(pTom, TOM_CHANNEL4, period);

 gtm_tomSetCompareReg2(pTom, TOM_CHANNEL4, duty_tom4);

 //simultaneous TOMs start

 gtm_tomStart();

 //start the Clock Management Unit (which generates fixed clocks for TOMs)

 gtm_cmuStart(&CMUD1);

 /* Application main loop.*/

 for ( ; ; ) {

 //do nothing

 }

}

ECAST.1
Associate II

Hello,

I've used your code in a SPC5Studio project for Bernina MCU, and the correct value of Duty and Period are triggered.0693W00000KaFpaQAF.jpg 

Come back to the original issue...

The TOM0_4 starts with settings period = 10000 and duty= 5000

The TOM0_3 starts with settings period = 10000 and duty= 4800

After 5 seconds (running) the duty of TOM0_3 is updated to 4600 using the API

gtm_tomUpdate_Duty_sync(&TOMD1, TOM_CHANNEL3, 4600);

(this API call the low level function gtm_tomSetCompareReg2())

Also in this case correct value are triggered.

0693W00000KaFvTQAV.jpg 

If you are using the SPC5Studio in the attachment the project used.

Please focus in the GTM component configuration.

Regards,

Emanuele

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.