Some advice, please, on ADC with the F28069
Submitted by lxman on Wed, 03/28/2012 - 16:56
I have taken the ADCtestF28069 example and modified it for learning purposes. Instead of using the direct monitoring of an analog channel, I have changed the program to use the Monitor Buffer facility. This is working well, except for the following:
I have sized my buffer to 2500 bytes (or is that words?). Over the course of ten seconds, the buffer updates twice on the plot - an average of five seconds to fill the buffer. This makes me think that the ADC is sampling at about 500 Hz. I need about 2 MHz sample rate on one channel.
Could you please check the attached files and tell me what I have incorrectly configured?
Thank you in advance.
Answers
-
Submitted by Anders89 on Wed, 03/28/2012 - 23:17.
Lxman, your diagram is configured to run at 1 kHz, so even though you are pacing the ADC0 to trigger at 2 MHz, you are only recording the ADC0 data to the buffer at 1 kHz. In the attached file, the ADC read and store to the monitor buffer is done inside an ADC EOC0 interrupt handler. This is done by:
- Encapsulate the ADC read and store to monitor buffer inside the 'ADC Sample' compound block
- ctrl+right click on the compound block and select the 'Execute on Interrupt' option
- Click the 'Select...' button
- Choose ADCINT1 from the list (any ADCINT will work)
- Select EOC0 (End Of Conversion channel 0) under 'Mode' As we recently added the Piccolo ADC interrupt option, you may need to download and install the latest version of ECD from our website. As always, do not uninstall your current VisSim, just run this install and it will update files as needed.
Note that taking interrupts at 2 MHz on an 80 MHz part is a tall order. You only have 40 processor ticks in which to accomplish the interrupt vector, pipeline stall, stack save, VisSim code, stack restore, return and pipeline stall. I suspect you will need to back down to 1 Mhz to get this to work.
0 -
Submitted by lxman on Thu, 03/29/2012 - 06:57.
Yes, that leads me down the right road. Thank you for the information.
Michael
0