How can I read the AD samples simultaneously?

classic Classic list List threaded Threaded
4 messages Options
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

How can I read the AD samples simultaneously?

Hello guys,

I'm doing an AC power meter using STM32F103RET6 to collect samples, but to read the phase between voltage and current I need to take two samples simultaneously.
I know that the STM32
F103RET6 has three ADCs, and that they can take simultaneous samples.
I looked at the eLua documentation and found nothing about it.
Is there a way to get two readings on two different channels simultaneously using eLua?

Thanks,
Ives

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: How can I read the AD samples simultaneously?

Check out these examples:
http://wiki.eluaproject.net/ADCPoll
http://wiki.eluaproject.net/ADCScope

You can just pass multiple channels instead of one.  Note, however
that I'm not using all three ADCs, just one and using multiplexing, so
the samples won't be at precisely the same time.  If
scanning/multiplexing isn't suitable, it's certainly possible to use
the additional channels, but it likely wouldn't fit too well with the
existing API and might require a platform specific module to
configure.

I would have to dig around a bit to figure out what clock the ADC
peripheral is running at and what the window size is in terms of us or
ns, but I believe I have the peripheral clock set pretty high, so the
delay between scanned channels might be somewhere in the microsecond
range.

Regardless if you need help or more details let me know.

Best.

-jsnyder

On Tue, Feb 8, 2011 at 1:49 PM, Ives Cunha <[hidden email]> wrote:

> Hello guys,
>
> I'm doing an AC power meter using STM32F103RET6 to collect samples, but to
> read the phase between voltage and current I need to take two samples
> simultaneously.
> I know that the STM32F103RET6 has three ADCs, and that they can take
> simultaneous samples.
> I looked at the eLua documentation and found nothing about it.
> Is there a way to get two readings on two different channels simultaneously
> using eLua?
>
> Thanks,
> Ives
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Ives Cunha Ives Cunha
Reply | Threaded
Open this post in threaded view
|

Re: How can I read the AD samples simultaneously?

2011/2/9 James Snyder <[hidden email]>
Check out these examples:
http://wiki.eluaproject.net/ADCPoll
http://wiki.eluaproject.net/ADCScope

Thanks Snyder, sorry for the delay.

You can just pass multiple channels instead of one.   
Note, however
that I'm not using all three ADCs, just one and using multiplexing, so
the samples won't be at precisely the same time.  If
scanning/multiplexing isn't suitable, it's certainly possible to use
the additional channels, but it likely wouldn't fit too well with the
existing API and might require a platform specific module to
configure.


Multiplex channels of ADC should work. I just didn't knew how do that in eLua.
 

I would have to dig around a bit to figure out what clock the ADC
peripheral is running at and what the window size is in terms of us or
ns, but I believe I have the peripheral clock set pretty high, so the
delay between scanned channels might be somewhere in the microsecond
range.

You're right. The delay is very small, so there is no problem at all.
I did some testing and I am happy to say that it working well.
 
Regardless if you need help or more details let me know.

If I need more help I ask here.
 
Best.

-jsnyder

 
Thanks again,
Ives
 
On Tue, Feb 8, 2011 at 1:49 PM, Ives Cunha <[hidden email]> wrote:
> Hello guys,
>
> I'm doing an AC power meter using STM32F103RET6 to collect samples, but to
> read the phase between voltage and current I need to take two samples
> simultaneously.
> I know that the STM32F103RET6 has three ADCs, and that they can take
> simultaneous samples.
> I looked at the eLua documentation and found nothing about it.
> Is there a way to get two readings on two different channels simultaneously
> using eLua?
>
> Thanks,
> Ives
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: How can I read the AD samples simultaneously?

On Tue, Feb 22, 2011 at 8:38 AM, Ives Cunha <[hidden email]> wrote:

> 2011/2/9 James Snyder <[hidden email]>
>>
>> Check out these examples:
>> http://wiki.eluaproject.net/ADCPoll
>> http://wiki.eluaproject.net/ADCScope
>
> Thanks Snyder, sorry for the delay.
>>
>> You can just pass multiple channels instead of one.
>>
>> Note, however
>> that I'm not using all three ADCs, just one and using multiplexing, so
>> the samples won't be at precisely the same time.  If
>> scanning/multiplexing isn't suitable, it's certainly possible to use
>> the additional channels, but it likely wouldn't fit too well with the
>> existing API and might require a platform specific module to
>> configure.
>>
>
> Multiplex channels of ADC should work. I just didn't knew how do that in
> eLua.

Perhaps this should be made a little clearer in the docs. In all cases
it currently means it will multiplex on the supported platforms and
all we say about adc.sample is: "Optionally, this may be a table
containing a list of channel IDs (i.e.: {0, 2, 3}), allowing
synchronization of acquisition."

I've filed an issue related to this so that it doesn't get lost:
http://tracker.eluaproject.net/issues/184

>
>
>> I would have to dig around a bit to figure out what clock the ADC
>> peripheral is running at and what the window size is in terms of us or
>> ns, but I believe I have the peripheral clock set pretty high, so the
>> delay between scanned channels might be somewhere in the microsecond
>> range.
>>
> You're right. The delay is very small, so there is no problem at all.
> I did some testing and I am happy to say that it working well.

Glad to hear it :-)

Also, if you're comfortable with it, feel free to share anything you'd
like about your project on the wiki or the list.

>
>>
>> Regardless if you need help or more details let me know.
>>
> If I need more help I ask here.
>
>>
>> Best.
>>
>> -jsnyder
>>
>
> Thanks again,
> Ives
>
>>
>> On Tue, Feb 8, 2011 at 1:49 PM, Ives Cunha <[hidden email]> wrote:
>> > Hello guys,
>> >
>> > I'm doing an AC power meter using STM32F103RET6 to collect samples, but
>> > to
>> > read the phase between voltage and current I need to take two samples
>> > simultaneously.
>> > I know that the STM32F103RET6 has three ADCs, and that they can take
>> > simultaneous samples.
>> > I looked at the eLua documentation and found nothing about it.
>> > Is there a way to get two readings on two different channels
>> > simultaneously
>> > using eLua?
>> >
>> > Thanks,
>> > Ives
>> > _______________________________________________
>> > eLua-dev mailing list
>> > [hidden email]
>> > https://lists.berlios.de/mailman/listinfo/elua-dev
>> >
>> >
>>
>>
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> [hidden email]
>> PGP: http://fanplastic.org/key.txt
>> Phone: (847) 448-0386
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
>



--
James Snyder
Biomedical Engineering
Northwestern University
[hidden email]
PGP: http://fanplastic.org/key.txt
Phone: (847) 448-0386
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev