ADC Synchronization

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

cross mob
User20530
Level 3
Level 3
25 sign-ins 25 replies posted 10 sign-ins

Hello everyone,

I have encountered some difficulties with the synchronized conversion of multiple adc kernels on my TC365.

I am using G1 as the master and G2 and G3 as slaves. Configured by the adcGroupConfig.groupId and adcGroupConfig.master. All grups should be converting Channel 2 synchronously. 

For this reason I have set the adcChannelConfig. synchonize = TRUE for the channel 2 of group 1. The slave channels are then also converting and the synchronization works fine. Lets call this case A.

Now I added a backgroundscan to the master. I have done this by configuring another queue[1], as the queue[0] was used to configure the master channel of the synchronous conversion. To be noted, the slave channels where also configured in their queue[0] of their respective group. But I did not start their queues, the conversion of the slaves is still performing well. And the G1 aslo converted my backgroundscans. So far so good. Lets call this case B.

Now I would like to add backgroundscans to my slave channels. Something like on Figure 271 of the TC3xx UserManual. I do it the same way as decribed above. So the background is added in queue[1] and is not started. Neiter is the queue[0] which holds the slave channel, this configuration worked in case A and B so I did not modify it. Unfortunately I do not see my backgroundscan of G2 or G3 converting. But the slave channel is still running. The IfxEvadc_Adc_startQueue function for queue[0] and queue[1] does not have an influence on the behaviour. The only influence I see is, when changing the adcGroupConfig.arbiter.requestSlotQueue0Enabled = TRUE; from TRUE to FALSE. Then the slave is not converting and the backgroundscan starts converting.

 

So here are my questions about how the master slave synchronization should be configured:

1. Is it necessary to add slave channels to a queue? If yes what options should be added? AutoRefill? Shouldn't this be done in the master and the slave would then follow the master?

2. Is it necessary to enable this queue?

3. Is it necessary to start the queue?

 

What would be the proper configuration for the master, slave and backgroundscan channels in my scenario? I could not find any application notes or code examples covering this issue. Are there any? 

 

Thanks for your help!

0 Likes
1 Solution
KB
Moderator
Moderator
Moderator
10 solutions authored 50 sign-ins 25 replies posted

Hi User20530,

From the register screenshot shared, I see you have configured "EVALR" for slaves groups and not the master group G-1.
For master group G1: G1SYNCTR.STSEL = 0, is correctly configured but master also requires ready signals from slaves as well so that
conversion can be synchronous between master and slave, this is my understanding from the Aurix User manual(refer below screenshot).

KB_0-1649938738121.png

 


Can you set G1SYNCTR.EVALR2 and G1SYNCTR.EVALR3  in group G1(since slaves are G2 and G3) and check if it works ?

Thank you.
Regards,
KB

 

View solution in original post

0 Likes
9 Replies
KB
Moderator
Moderator
Moderator
10 solutions authored 50 sign-ins 25 replies posted

Hi USer20530,

Please find my comments below:

1. Is it necessary to add slave channels to a queue? If yes what options should be added? AutoRefill? Shouldn't this be done in
the master and the slave would then follow the master?
Comment:
You only need to add the desired master channel(s) to the queue and set the G1CHCTR2->SYNC = 1, no need to add the slave channel(s) also to the queue.
As soon as the queue containing the master channel(s) is triggered the channel(s) with same channel number in the slave group would also start simultaneously.

2. Is it necessary to enable this queue?
Comment: refer above comment.

3. Is it necessary to start the queue?
Comment: Start the queue containing the master channel(s) and the queue containing the channels for "Background Scan".

In your case,
the channels in queue 1 and the slave channels can be same. I have not encountered any such restrictions in TC3xx User-manual.
Could you just add the channel 2(master channel of sync group) of G1 to queue 0 and configure the SYNC bit to 1 and add the channel 2(the slave channel) of G2 and G3 to queue 1
as part of your "Background Scan" ? It should work.

Let me know if the issue doesn't resolve.

Regards,
KB

 

 

0 Likes
User20530
Level 3
Level 3
25 sign-ins 25 replies posted 10 sign-ins

Hello KB,

I summarize my configuration, which I have adjusted according to your comments:

G2: -is slave to G1;

queue0 should convert the slave channel number 2; queue0 is not enabled, channel 2 is initialized but not added to queue0 and queue0 is not started

queue1 should convert the backgroundscan; queue1 is enabled with no trigger, different channels are initialized and added to the queue1; queue1 is started

G3: -is slave to G1;

queue0 should convert the slave channel number 2; queue0 is not enabled, channel 2 is initialized but not added to queue0 and queue0 is not started

queue1 should convert the backgroundscan; queue1 is enabled with no trigger, NO channels are initialized and NO channel is added to the queue1; queue1 is started

G1: -is the master

queue0 should convert the channel number 2 according to a trigger, queue0 is enabled, channel 2 is initialized using the .synchonize = TRUE option, channel 2 is added to queue0 and queue0 is started

queue1 should convert the backgroundscan; queue1 is enabled with no trigger, different channels are initialized and added to the queue1; queue1 is started

I have done the configuration, as I have read somewhere that the master should be initialized at the end. Noteworthy is that my trigger for channel2 is much slower than the backgroundscan. I set this up to be able to distinguish between those two.

So in Group1 I see channel2 being updated about every second, while all other channels run much quicker, this works fine.

In Group2 I see channel2 not being updated constantly putting out 0, while all the other channels run at high speed, like the backgroundscan should be

In Group3 I see channel3 beeing updated about every second, other channels are not initialized, so they are not updated.

As soon as I initialize just one background channel in Group3, the channel number2 puts out 0 and the backgroundscan starts converting similar to Group2

Now I implemented your advice and added channel 2 of G2 and G3 to queue1 which is my backgroundscan with the refill option. This leads to my backgroundscan converting my slave channels quicker than my slow trigger at the master. So there might be a synchronous conversion, but it gets overwritten because the channel samples itself again with the refill option.

When I do not add any option, I only see the slave channels be converted once, I assume they fall out of the queue, as there is no refill option enabled. But unfortunately the slave triggering does not seem to work.

0 Likes
KB
Moderator
Moderator
Moderator
10 solutions authored 50 sign-ins 25 replies posted

Hi USer20530,

Could you clarify the lines
"In Group3 I see channel3 beeing updated about every second, other channels are not initialized, so they are not updated."
"As soon as I initialize just one background channel in Group3, the channel number2 puts out 0 and the backgroundscan starts converting similar to Group2"

By background channel do you mean channel 2 of Group3 ? If no, then may have missed configuring the channel-2 of Group3 and hence its giving out 0.

For background channel configuration for all the groups(Group 1/2/3) along with configuring parameter reload for these channels did you configure parameter EXTR for
the first channel entry of the queue ? Without this parameter the queue will immediately convert as long as there are valid channels in the queue even
without trigger.(The reload parameter will
make sure that there are valid channel entries in the queue always).

KB_1-1649752573938.png

 

As for next part,
Once all the configurations are ready and queue is filled, before triggering can you make sure that the register GxSYNCTR (x=0-11) are properly initialized
(for both master and slave) and is not getting overwritten ?

 

KB_0-1649752476367.png

 


Also make sure that the queue0 where you have master channel with highest priority compared to your "backgroundscan" queue and see if it works ?

Regards,
KB

 

 

0 Likes
User20530
Level 3
Level 3
25 sign-ins 25 replies posted 10 sign-ins

Hello KB,

thanks for your reply. Here are the answers to the questions that I can immediately give.

I meant to write Group3 Channel2 as this is my slave. So if I do not edit any other backgroundscan channels in Group3, channel2 gets sampled about every second, just like the master (G1 channel2) is. But as soon I add backgroundscan channels, they get converted really quickly, but channel2 of G3 puts out 0. Sorry for the confusion.

 

No for the backgroundscans I did not configure the EXTR-Bit, I only set the RF for the automatic refill.

It is my intention to have the backgroundscan converting always and with no trigger. It should only be interrupted by the master slave conversion (which is time critical). So my backgroundscans queues get the lowest priority, while the master has the highest priority. Also the slotStartMode is configured to cancelInjectRepeat, to be able to interrupt the backgroundscan.

For the master I configure the EXTR, ENSi and RF bits.

0 Likes
User20530
Level 3
Level 3
25 sign-ins 25 replies posted 10 sign-ins

Here you can see a screenshot of my debugger. I do not see an issue in the configuration of the SYNCTR registers:

User20530_0-1649767684394.png

 

0 Likes
KB
Moderator
Moderator
Moderator
10 solutions authored 50 sign-ins 25 replies posted

Hi User20530,

From the register screenshot shared, I see you have configured "EVALR" for slaves groups and not the master group G-1.
For master group G1: G1SYNCTR.STSEL = 0, is correctly configured but master also requires ready signals from slaves as well so that
conversion can be synchronous between master and slave, this is my understanding from the Aurix User manual(refer below screenshot).

KB_0-1649938738121.png

 


Can you set G1SYNCTR.EVALR2 and G1SYNCTR.EVALR3  in group G1(since slaves are G2 and G3) and check if it works ?

Thank you.
Regards,
KB

 

0 Likes
FD_aurix
Level 5
Level 5
100 sign-ins 100 replies posted 5 solutions authored

Yes, I think also that is necessary to set EVALR2 and EVALR2 on the master SYNCTR.

What about the same register setting on the slave? it is necessary or it is not used since it is a slave module?  

0 Likes
KB
Moderator
Moderator
Moderator
10 solutions authored 50 sign-ins 25 replies posted

Hello FD_aurix,

From the explanation given in the user-manual, I think configuring master is enough since its the master that waits for slaves to be ready.  Therefore it should work without configuring the EVALRx in slaves.

Thank you.

Regards,

KB

0 Likes
User20530
Level 3
Level 3
25 sign-ins 25 replies posted 10 sign-ins

Hello KB and FD_aurix,

I followed your suggestion and the conversion of the ch2 of G2 and G3 follow G1 (every second I get one conversion) and in the meantime I have my backgroundscan converting. This seems to solve my problem, thanks!

There are only a few things that I am not that clear about. I was using the Ifx functions for the configuration. The master slave configuration is done in the IfxEvadc_Adc_initGroup as far as I saw. 

User20530_0-1650445197901.png

Usually for a master the code went trough the else case and the do nothing comment. I have changed the code for my need with the red encircled else if case. Did I miss something in some Ifx functions or is it really necessary to have another case configuring the master? And how would it work if I would like to have G8 as a slave of G1, since there are only EVALR1,2 and 3 Bits in the GxSYNCTR Register?

0 Likes