|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Generate interrupt signal and measure latencyDear All, I’m hoping to use an external PIC microcontroller to
generate a interrupt signal to control the sampling sequence of an ADC via the
SPI bus on the Gumstix. I’m using the Connex 400xm-bt board. The interrupt signal from the PIC needs to
precede the point in time that the ADC reading will be taken, since it will
cause an interrupt in the Gumstix, and that interrupt, however high priority,
will take time to service (stacking registers etc.) before the ADC can be told
to read. In order to program the timing sequence correctly, I’ll need to measure the time it takes for the interrupt
signal to activate the ADC and read the sample on the Gumstix,
thereafter estimate how far in advance of the time that it should read we need
to output the signal from the PIC. Can I ask if anyone has tried doing something similar? I’ll
greatly appreciate if anyone can advise me on how should I go about simulating
this interrupt signal (without having the PIC) using one of the GPIO lines from
the gumstix and then measure the latency? I’m really sorry if this sound straightforward
to some of you as I’m new to this sort of programming. Thanks for your help in advance. Peck ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gumstix-users mailing list gumstix-users@... https://lists.sourceforge.net/lists/listinfo/gumstix-users |
|
|
Re: Generate interrupt signal and measure latencyHi Peck,
> I'm hoping to use an external PIC microcontroller to generate a interrupt > signal to control the sampling sequence of an ADC via the SPI bus on the > Gumstix. I'm using the Connex 400xm-bt board. > > > > The interrupt signal from the PIC needs to precede the point in time that > the ADC reading will be taken, since it will cause an interrupt in the > Gumstix, and that interrupt, however high priority, will take time to > service (stacking registers etc.) before the ADC can be told to read. In > order to program the timing sequence correctly, I'll need to measure the > time it takes for the interrupt signal to activate the ADC and read the > sample on the Gumstix, thereafter estimate how far in advance of the time > that it should read we need to output the signal from the PIC. > > > > Can I ask if anyone has tried doing something similar? I'll greatly > appreciate if anyone can advise me on how should I go about simulating this > interrupt signal (without having the PIC) using one of the GPIO lines from > the gumstix and then measure the latency? I'm really sorry if this sound > straightforward to some of you as I'm new to this sort of programming. Sure, you can just connect 2 GPIOs on the gumstix together. Configure one as input (which will eventually come from the PIC) and one as output (which you can trigger from user space or however you feel like). You then need to have the interrupt handler, or wherever it is that you'll be getting the sample from to toggle a third GPIO. You can then measure (using an oscilloscope) the difference in time between the 2 GPIOs being changed. Also keep in mind that the GPIO inputs must be at 3.3v. Many PICs run at 5v, which is why I'm pointing this out. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gumstix-users mailing list gumstix-users@... https://lists.sourceforge.net/lists/listinfo/gumstix-users |
|
|
Re: Generate interrupt signal and measure latencyPeck H Koh wrote:
> Dear All, > > I'm hoping to use an external PIC microcontroller to generate a interrupt > signal to control the sampling sequence of an ADC via the SPI bus on the > Gumstix. I'm using the Connex 400xm-bt board. Wrong approach, if you want uniform samples. If you can tolerate 1ms jitter in the samples, then proceed. If you need tighter tolerance, you will need to drive your ADC directly with the external clock, and then FIFO enough data someplace (perhaps the NSSP FIFO is deep enough at 16 samples). > The interrupt signal from the PIC needs to precede the point in time that > the ADC reading will be taken, since it will cause an interrupt in the > Gumstix, and that interrupt, however high priority, will take time to > service (stacking registers etc.) before the ADC can be told to read. In > order to program the timing sequence correctly, I'll need to measure the > time it takes for the interrupt signal to activate the ADC and read the > sample on the Gumstix, thereafter estimate how far in advance of the time > that it should read we need to output the signal from the PIC. > > Can I ask if anyone has tried doing something similar? I'll greatly > appreciate if anyone can advise me on how should I go about simulating this > interrupt signal (without having the PIC) using one of the GPIO lines from > the gumstix and then measure the latency? I'm really sorry if this sound > straightforward to some of you as I'm new to this sort of programming. You can generate a signal with a pulse generator, set to output a pulse that goes from 0V to 3.3V. You can measure the latency on an oscilloscope from that pulse to the operation of the SPI pins in response to that pulse. You could also toggle any GPIO line, in place of actually running the SPI, if you haven't gotten that far yet. I don't think you can make this sort of measurement in software, as too many things are dependent on the interrupt service you are trying to measure. You might have some luck making calls to do_gettimeofday in the kernel. -- Ned Forrester nforrester@... Oceanographic Systems Lab 508-289-2226 Applied Ocean Physics and Engineering Dept. Woods Hole Oceanographic Institution Woods Hole, MA 02543, USA http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212 http://www.whoi.edu/hpb/Site.do?id=1532 http://www.whoi.edu/page.do?pid=10079 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gumstix-users mailing list gumstix-users@... https://lists.sourceforge.net/lists/listinfo/gumstix-users |
|
|
Re: Generate interrupt signal and measure latencyHI Ned,
> > I'm hoping to use an external PIC microcontroller to generate a interrupt > > signal to control the sampling sequence of an ADC via the SPI bus on the > > Gumstix. I'm using the Connex 400xm-bt board. > > Wrong approach, if you want uniform samples. If you can tolerate 1ms > jitter in the samples, then proceed. If you need tighter tolerance, you > will need to drive your ADC directly with the external clock, and then > FIFO enough data someplace (perhaps the NSSP FIFO is deep enough at 16 > samples). To eliminate jitter entirely, you should have the PIC grab the sample (using either its onchip ADC or an external ADC) and after it has grabbed the sample generate the interrupt. Then use SPI to grab the sample from the PIC. The PIC could even implement a small FIFO. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gumstix-users mailing list gumstix-users@... https://lists.sourceforge.net/lists/listinfo/gumstix-users |
| Free Forum Powered by Nabble | Forum Help |