TC275 DAC conversion time too long

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

cross mob
User19008
Level 1
Level 1
I used the TimerWIthTrigger example for the CCU6 to operate the T12 timer in UpDown mode together with a PWM and the T13 timer in single shot mode to generate a trigger in the middle of the pwm intervall that
is used to start a scan with 1 channel on group 0 of the adc, The EOC of the adc is used to generate an interrupt for cpu0.
Additionally the trigger signal is shown on a pin for test purposes.

So far everything works fine.
The trigger gets active in the middle of the pwm interval and the isr is called to read converted value from adc.
The big problem: the time form start of convertion of the adc (trigger) to start of the isr is nearly 4 µs. This cannot be!!!!
Starting the isr directly with the trigger takes less than 0,2 µs. The conversion time of the adc should be below 1 µs.
What happens in the rest of the time?
Has anyone an explanation?
0 Likes
7 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Is there an OS in the way, or is your breakpoint directly on the vector in BIV?

Are you using the MCAL, or the iLLD? Could your use of CCU6 T13 be interfering with the workaround listed in the errata sheet for ADC_TC.068?

For your application, what are the settings for SPB clock, GLOBCFG.DIVA, GLOBCFG.DIVD, and GxARBCFG.ARBRND?

Are there other higher priority interrupts in your application?

Are there critical sections in your application where interrupts are disabled?
0 Likes
User19008
Level 1
Level 1
Hi UC_wrangler, thank you very much for your attention.

I have a very small test environment. No OS, isr called direct, no critical sections, not other interrupt.
iLLD is used.
Workarounds mentioned in errata sheet were not used.

GLOBCFG.DIVA = 4
GLOBCFG.DIVD = 0
GxARBCFG.ARBRND = 0
Vadc digitalFrequency = 1e8
Vadc analog Frequency 2e7
Vadc module frequency 1e8
CCU6 frequency 1e8
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Those basics look OK. How about the VADC channel configuration? Can you capture GxCHCTRy, GxICLASS0/1, and GLOBICLASS0/1? Perhaps STCS is too big.
0 Likes
User19008
Level 1
Level 1
I show you how I got the required info, to avoid misunderstandings:
MODULE_VADC.G[0].CHCTR[0].U=0
MODULE_VADC.G[0].ICLASS[0].B.STCS=18
MODULE_VADC.GLOBICLASS[0].B.STCS=18
MODULE_VADC.G[0].ICLASS[1].B.STCS=18
MODULE_VADC.GLOBICLASS[1].B.STCS=18
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Per Table 28-4 on page 3953: STCS=18 gives an effective sample time of 50 / fADCI
Then from 28.6.7 Conversion Timing on page 3967:

tCN = (2 + STC + N + PC) * tADCI + 2 * tVADC
= (2 + 50 + 12 + 2) * 50 ns + 20 ns
= 3300 ns

Could you try something like this to reduce STCS?

// I'm not entirely sure how the math works in this function but the goal is to get STCS=10
IfxVadc_setGroupSampleTime( vadcg, 0, 12000000.0, 0.000001);


That should bring your time down. Whether that sampling time is enough depends on your impedance, etc.
0 Likes
User19008
Level 1
Level 1
Thanks a lot. This works.
There is an error in

IFX_INLINE uint32 IfxVadc_calculateSampleTime(float32 analogFrequency, float32 sampleTime)
{
uint32 ticks;

ticks = (uint32)(sampleTime * analogFrequency) - 2;

if (ticks > 16) // >31 will ignore some allowed values of ticks. 16 corresponds to table 28-4 in the manual
{
ticks = (ticks / 16) + 15;
}

ticks = __minu(ticks, 0xFFu);

return ticks;
}

I set the samplingTime=1e-7 to get an STCS=0. This is lower then your proposed 10. Is there any drawback with the smaller value?
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Whether the smaller value will work depends on your analog circuit. See Application Note AP56003 on MyICP for details - in particular, section 5.4.

Sampling too fast will lead to increased error.
0 Likes