We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Visitor acidka
Registered: ‎08-01-2017

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.


0 Kudos
1 Reply
Visitor acidka
Registered: ‎08-01-2017

Re: Zynq-7000 TTC counter and RC

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

0 Kudos