Problem writing to the channel counters in TPM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem writing to the channel counters in TPM

Jump to solution
1,055 Views
karthick1987
Contributor II

Hi guys,

 

I was using a GT16A today and I found that when I wrote to the TPM1C0VL and H registers, the values didnt seem to get written the result was rather strange. I monitored the values of the register on the debugger and got '"' 34 . I am not sure why this happens and every time I over write it it still remains the same (the initialised value),

 

What has to be done to change the value every duty cycle?

Labels (1)
0 Kudos
Reply
1 Solution
531 Views
peg
Senior Contributor IV

Hello Karthick,

 

The only limitation here should be the coherency latch mechanism. You need to read and write BOTH bytes every time.

It is also possible to get this "out of step" if you are not writing to TPMxCnSC in between update pairs i.e. you are writing the second byte then the first each update rather than first/second.

View solution in original post

0 Kudos
Reply
3 Replies
531 Views
karthick1987
Contributor II

in other words

 

how do we over write the counter in PWM mode after every duty cycle?

 

Cheers

Karthick

0 Kudos
Reply
532 Views
peg
Senior Contributor IV

Hello Karthick,

 

The only limitation here should be the coherency latch mechanism. You need to read and write BOTH bytes every time.

It is also possible to get this "out of step" if you are not writing to TPMxCnSC in between update pairs i.e. you are writing the second byte then the first each update rather than first/second.

0 Kudos
Reply
531 Views
karthick1987
Contributor II

Hi Peg,

 

Thanks but the debugger is bizarre!!! 

 

When you restart code-warrior and try it it works fine! I cannot believe it.

 

So moral of the story, restart the program and try again if you think you have done everything you can and it still dosent work!

 

Cheers

Karthick

0 Kudos
Reply