• 0

Zynq-7000 TTC counter and RC


Hello all.

I have some misunderstanding with TTCs on zynq-7000. I used this guide to understand how TTCs are working, but seems like a quite subtlety which I don't understand.

I have to use 2 TTCs with PWM (match value) and change RC in handlers to make CNC. After trying to make it like get new RC in handler and change RC I got unstable error for about 0.5s for 25s of changing RC and some impulses haven't generated but handler was called instantly after changing RC (I took into account that (RC - match value) should be greater then 0).

I thought it can be because I have to:
1) reduce time we waste in handler (some code fragments like change RC made by asm);
2) consider some information we lose when we shift RC to prescaler;
3) consider counter of my timer because there are sometimes another handlers or something;
4) when we change RC we should reset counter (special bit in XTTCPS_CNT_CNTRL register);
5) see if RC is less then counter - make RC as match value (never happens).

After this manipulations I saw that my timers with same amount RC (before counter compensation) ends in different time (I used different counters so timers have different number of RC).

Can someone help me?

P.S. I tried to use inline functions with asm() to change RC. Universal (by transmit using timer number) and 2 different functions with same (different only address to timer) asm code, and I got different results. I don't understand why.


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

There is a test project and terminal screenshot of program running:

it shows:
one timer stops, anouther have *number* steps more (print not stopped axis steps, for example X44 would show us that second timer is now stopped and first is running and need 44 handlers more)
second timer stops, anouther have *number* steps more (always 0)
time for first timer, second timer and for all task



Edited by Acidka
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now