On Fri, Apr 5, 2013 at 1:42 AM, Andres Mabini <[email protected]>wrote:

> Hi Eric,
>
> Thanks for the very fast reply. I looked at the User Guide and it just
> says there that the 12-bit ADC is capable of more than 200Ksps.
>

Everything I've looked at also seems to imply that it should work.   No
warning flags.  Meaning nothing jumps out and says this is nuts.


>
> I got 25 using the computation in tos/chips/MSP430/adc12/README.txt as a
> pattern. The example there is just for 4000Hz though - much smaller than my
> desired sampling frequency of 40Khz.
>

I just went and looked at that file (why did you capitilize MSP430?  Linux
is case sensative.  Just odd that is all).

Your calc seem reasonable.    The assumption though is that the timer
system is being clocked at 1MiHz which is true.   Bottom line is you should
see about 40K samples or so.


>
>  I am just wary of hitting any limitations that the chip may have, or
> whether I am going about it(reaching 40KHz sampling rate) the right way.
>
> You're right, the code does work in a sense that I am getting samples,
> however, I am not sure that the chip indeed is sampling at 40kHz(is there
> even a way of verifying that?)
>

Yes you can verify this.   Write some test code that generates samples like
you have outlined.   Basically do nothing but fire off samples.   As each
sample completes increment a counter.

Also fire up a timer, say for 1 second.   you want to be careful about what
units you are using for time.   TinyOS uses binary time, ie. TMilli runs in
units of binary millisecs (1mis = 1/1024 secs).

Fire up a 1 second timer (1024 TMilli ticks), right when you fire the time
up, zero the sample counter.    When the timer fires, see how many samples
you've done.   It should be around 42 * 1000.   1000 because you did the
1MiHz (1 x 1024 x 1024 = 1048576)/25 = ~ 42KHz.

If you were looking for 40KHz why didn't you divide by 26?




> Again, thanks. I guess this code's already OK then, at least in terms of
> achieving 40Khz.
>

Everything I've looked at implies that.    You should be fine.


>
>
> On Fri, Apr 5, 2013 at 1:13 AM, Eric Decker <[email protected]> wrote:
>
>> you will need to study the cpu documentation.
>>
>> are you using the telosb?
>>
>> the manual you want for the 1611 is the User's Guide for the 1611 family.
>>  msp430x1xx
>>
>> You should also look at the specific data sheet for the part.
>>
>> Where did you get the number 25 from?
>>
>>
>> But all things considered (I just looked at the data sheet), it should
>> work.
>>
>>
>>
>> On Fri, Apr 5, 2013 at 12:49 AM, Andres Mabini 
>> <[email protected]>wrote:
>>
>>> Hi all,
>>>
>>> What is the maximum sampling frequency that the MSP430 12-bit ADC could
>>> support?
>>>
>>> If I want to sample at around 40KHz using Msp430Adc12ClientAutoDMAC() as
>>> the client, am I doing it correctly if I set the config as
>>>
>>> #define CONFIG_AVCC INPUT_CHANNEL_A0, REFERENCE_AVcc_AVss,
>>> REFVOLT_LEVEL_NONE, SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1,
>>> SAMPLE_HOLD_4_CYCLES, SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1
>>>
>>> and call
>>>
>>> call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 25
>>>
>>> ?
>>>
>>> I reckoned 1048576 / 25 = 41 934, so the resulting sampling frequency
>>> would then 41KHz. Is this correct?
>>>
>>> Much thanks.
>>>
>>>
>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> [email protected]
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>
>>
>>
>>
>> --
>> Eric B. Decker
>> Senior (over 50 :-) Researcher
>>
>>
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to