2022-02-22 02:01 AM
Hallo Everyone,
If I setup two TOM channels with the TOM module clocked at 100MHz: (10nSec)
[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.
2022-02-22 02:29 AM
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
}
}
2022-02-23 05:59 AM
Hello,
I've used your code in a SPC5Studio project for Bernina MCU, and the correct value of Duty and Period are triggered.
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.
If you are using the SPC5Studio in the attachment the project used.
Please focus in the GTM component configuration.
Regards,
Emanuele