How do I set up K24 Multiplexed inputs to the ADC. Mixture of differential and single ended inputs

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

How do I set up K24 Multiplexed inputs to the ADC. Mixture of differential and single ended inputs

855 Views
DaveTonyCook
Contributor IV

Hi

I want to connect 1 differential input and 1 single ended input to the ADC0.  The ADC is triggered via the PDB periodically at the required sample rate.  I need to sample the differential input followed by the single ended input within the PDB period before repeating the sequence.

Is this possible?

Is this the correct way to use the PDB/ADC to sample multiple inputs?

Can you mix single ended and differential input when multiplexing?

Thanks

Tags (1)
0 Kudos
4 Replies

563 Views
apanecatl
Senior Contributor II

Usually the PDB is used to trigger simultaneous channel sampling using 2 or more ADC modules, instead of using the PDB to trigger a periodical ADC conversion I would use a simple timer, in any way before performing the conversion the ADC mode and the channels must be configured, if you are looking for a sequential conversion with a very reduced to no-time between the differential and single ended measurements I suggest you configure ADC0 to perform the differential measurement and ADC1 to perform the single ended measurements, you trigger them at the same time with the PDB, this way you don't have to constantly reconfigure the module/channels. However if your measurements are no time sensitive you can  reconfigure the module/channels prior to the measurement.

563 Views
DaveTonyCook
Contributor IV

Hi Pedro,

Thanks for your reply; I gave the case for a single ADC as I thought this would be simpler to explain however the full story is that we need to use the PDB to achieve simultaneous sampling of two ADC modules.

Explanation:

We have 4 signals

Signal_X - output from phase discriminator frequency range 2Hz to 44Hz

Signal_Y - output from phase discriminator frequency range 2Hz to 44Hz

I_Mon - coil current DC

+12V - supply voltage DC

The X,Y signals are converted into their polar form post ADC and Filtering so that phase angle and magnitude can be calculated, so as you can see we need excellent phase coherence between the sampled X&Y signals.  Using the PDB to pre-trigger the ADC's gives us this. The results are excellent.  The maximum sample rate is 2.8KHz

I need to measure the X and Y signals differentially as this gives use better noise immunity, however we only need to sample the other two signals single endedly.  I would arrange the inputs as follows:-

X_input, I_mon          -> ADC0

Y_input, +12v_mon    ->ADC1

Taking ADC0 it is required that X_input, I_mon be sampled sequentially starting back at X_input in time for the next pre trigger from the PDB.  The only constraint is that both the X_input and the I_mon input must be sampled within ~355us and that both X_input and Y_input must be sampled simultaneously.


So, from what you say I would be able to reconfigure the module/channels between each conversion?


As I understand it from the users manual, if I set the initial configuration to sample the differential channel when the pre trigger is received and then from within the ADC ISR write to SC1[ADCH] the next channel to be sampled, this would start the conversion on the selected channel straight away?  I could then reconfigure the channel when I received the next ADC interrupt so that it is now sampling the differential input?  However, as I understand it writing to SC1 starts the next conversion which is not what I want.  The differential input must always be synchronised to the PDB.  Can you advise


Thanks

0 Kudos

563 Views
apanecatl
Senior Contributor II

Check AN4822, it will give you a detailed insight of how the PDB works to perform simultaneous ADC measurements using multiple modules. You can find the document here:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4822.pdf

0 Kudos

563 Views
ndavies
Contributor V

Look for application Note AN4590. I think it will do what you want to do.

http://cache.freescale.com/files/32bit/doc/app_note/AN4590.pdf?fasp=1&WT_TYPE=Application Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation&fileExt=.pdf

0 Kudos