Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

Hello, I am on TC364.

I want to link 3 adjacent TOM channels (TOM0.13 TOM0.14 TOM0.15) so that the Periods are all the same in in sync. 
Or another way to say it, I want the reset of CN0 on TOM0.13 to trigger a reset of CN0 on TOM0.14, and this to cascade through and reset the CN0 of TOM0.15. 

I have set
TOM0_CH14_CTRL.RST_CCU0 = 1    ( Reset CN0 to 0 on TRIG_[x-1] )
TOM0_CH14_CTRL.EXT_TRIG = 0    ( TRIG_[x-1] is selected, not TIM_EXT_CAPTURE(x) )

TOM0_CH15_CTRL.RST_CCU0 = 1    ( Reset CN0 to 0 on TRIG_[x-1] )
TOM0_CH15_CTRL.EXT_TRIG = 0    ( TRIG_[x-1] is selected, not TIM_EXT_CAPTURE(x) )

TOM0_CH13_CM0 is set to 0x1388 (dec 5000) and TOM0_CH13_CN0 does reset at 0x1388-1.
BUT CNO of TOM0_14 and TOM0_15 just count up to 0xFFFF and overflow... 

What am I missing please ? 

Thank you

 

0 Likes
1 Solution
Yuva
Moderator
Moderator
Moderator
250 replies posted 250 sign-ins 100 solutions authored

Hello,

I guess you are synchronously updating the ATOM channel 13 with the new period, do you also update channels 14 and 15? For the ADC trigger topic, you can create a new thread as it is an independent discussion.

Thanks.

View solution in original post

7 Replies
User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

I think I figured it out. I had to set 
TOM0_CH13_CTRL.TRIGOUT = 1 so that CH13 would output its CCU0 reset signal to its TRIG_[x] output. 

Full settings as below and I think it is working how I want it. 

TOM0_CH13_CTRL.EXTTRIGOUT = 0
TOM0_CH13_CTRL.TRIGOUT = 1   
TOM0_CH13_CTRL.RST_CCU0 = 0
TOM0_CH13_CTRL.EXT_TRIG = 0  

TOM0_CH14_CTRL.EXTTRIGOUT = 0
TOM0_CH14_CTRL.TRIGOUT = 0  
TOM0_CH14_CTRL.RST_CCU0 = 1
TOM0_CH14_CTRL.EXT_TRIG = 0  

TOM0_CH15_CTRL.EXTTRIGOUT = 0
TOM0_CH15_CTRL.TRIGOUT = 0  
TOM0_CH15_CTRL.RST_CCU0 = 1
TOM0_CH15_CTRL.EXT_TRIG = 0  

Next questions will be about triggering ADC from a TOM PWM. 
I will want to trigger 1 ADC queue/group from 2 TOM PWM channels (but not at the same time). 
I will open separate question on that if I need. 

Any further advice on this question will be welcomed, I expect there are things I have missed. 

0 Likes
User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

I have hit another strange behaviour. 

If I update TOM0_CH13_SR0 from 0x1388 to 0xFA0  then the PWM outputs of CH14 and CH15 stop even though their CM1 values are below 0xFA0. I have no idea why yet. 

I can not see the PWM output of CH13 as it is not connected to a PIN. I plan to use it for internal trigger of ADC only. 

Any help gratefully received. 

Thanks

0 Likes
Yuva
Moderator
Moderator
Moderator
250 replies posted 250 sign-ins 100 solutions authored

Hello,

I guess you are synchronously updating the ATOM channel 13 with the new period, do you also update channels 14 and 15? For the ADC trigger topic, you can create a new thread as it is an independent discussion.

Thanks.

User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

Hi Yuva, 

Yes I am synchronously updating the period of TOM0.CH13 - writing to SR0 not direct to CM0. 

I have now updated my code to write also to SR0 of TOM0.CH14 and TOM0.CH15 with the same new period value and the 3 channels all update their period now. 
I am a bit confused why I have to update the SR0 -> CM0 of the other channels though because I thought they would reset CN0 to zero based on the trigger from TOM0.CH13. I would be grateful for some explanation of this but I can do what I need to do now 🙂

I will raise separate ticket for ADC questions as correctly suggested. 

Thank you all very much. 

0 Likes
Yuva
Moderator
Moderator
Moderator
250 replies posted 250 sign-ins 100 solutions authored

Hello,

The slave (CH14 and 15) are reset based on the period of the mater (CH3) but the edges within this period is based on their CM1 and CM0 values.

Thanks.

User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

Hi Yuva, 

I also find that if I set CM1 to 0 (zero) on a slave channel (CH14 or CH15) I do not get the same behaviour as if I set CM1 to 0 on the master channel (CH13).  The period value (SR0 or CM0) is 5000 in all 3 channels. 

On the master channel (CH13) the output will be HIGH for the whole period if CM1 = 0
The output will be LOW for the whole period if CM1 = 5000 (same as CM0)

On a slave channel (CH14 or 15) the output will be LOW for the whole period if CM1 = 0.
Changing CM1 to 1 gets the output to be HIGH for 99.9% of the period, with a very short low pulse at the start of the period. This is different to the behaviour on the master channel. 
It is important to get the same behaviour and be able to set the output to totally HIGH by use of Duty Cycle = 0 

On slave channel the output will be LOW for the whole period if CM1 = 5000 (same as CM0)

How can I get the behaviour I need where the output will be HIGH for the whole period if CM1 = 0 on all channels  please ? 

0 Likes
User21958
Level 1
Level 1
10 sign-ins 5 likes given 5 replies posted

Hello Yuva, 

thank you very much for the extra explanation and a good solution to my questions. 

Kind Regards

0 Likes