Discussion:
[Shimmer-users] Position in the buffer for analog channels
Jose F. Mingorance-Puga
2013-03-20 14:48:54 UTC
Permalink
Hello,

I have been trying to figure it out but still cannot come to a conclusion.

I call the command Msp430DmaChannel.repeatTransfer to start a transfer
in the ADC. One of the arguments passed to the method is a buffer where
the quantized data should fall. The problem is, how can I know in which
position of the buffer is each channel of those I am converting?

In the beginning I just observed manually the contents of the buffer to
guess what channel was in what position, but now I am reconfiguring the
converter in runtime, and I do not know any more in which position each
channel goes. For instance, imagine first I am sampling gyroscope and
accelerometer. Then I disable the accelerometer and read the analog
channel 7. It would be useful to know how to identify what position of
the buffer contains each channel.


Sincerely,


Jose F. Mingorance-Puga
mike healy
2013-03-21 09:09:21 UTC
Permalink
Hi Jose,

I'm not sure if I'm fully understanding your question.

But you might find it helpful to read up on how the ADC on the MSP430F1611
works, specifically ADC12MCTLx registers and sequene-of-channels mode (page
17-12 of the user guide: http://www.ti.com/lit/ug/slau049f/slau049f.pdf).

Then take a look at the implementation of shimmerAnalogSetup (especially
the initADC12MEMCTLx() function):
https://github.com/tinyos/tinyos-main/blob/master/tos/platforms/shimmer/shimmerAnalogSetupP.nc

So, the short answer to your question (as I understand it) is that it
depends on the order the sensors were configured with.

Mike


On Wed, Mar 20, 2013 at 2:48 PM, Jose F. Mingorance-Puga <
Post by Jose F. Mingorance-Puga
Hello,
I have been trying to figure it out but still cannot come to a conclusion.
I call the command Msp430DmaChannel.**repeatTransfer to start a transfer
in the ADC. One of the arguments passed to the method is a buffer where the
quantized data should fall. The problem is, how can I know in which
position of the buffer is each channel of those I am converting?
In the beginning I just observed manually the contents of the buffer to
guess what channel was in what position, but now I am reconfiguring the
converter in runtime, and I do not know any more in which position each
channel goes. For instance, imagine first I am sampling gyroscope and
accelerometer. Then I disable the accelerometer and read the analog channel
7. It would be useful to know how to identify what position of the buffer
contains each channel.
Sincerely,
Jose F. Mingorance-Puga
______________________________**_________________
Shimmer-users mailing list
https://lists.eecs.harvard.**edu/mailman/listinfo/shimmer-**users<https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users>
Jose F. Mingorance-Puga
2013-03-21 11:23:14 UTC
Permalink
Dear Mike,

The principle of the ADC on the MSP430F1611 and the function ADC12MCTLx
are clear. But none of those implies an specific order of the sampled
data in the buffer when using the command
Msp430DmaChannel.repeatTransfer. I understand the order will depends on
how this abstraction of the hardware/API is dealing with the buffer and
the ADC. I have not found nothing explicitly mentioned about the order
of the data.

I guessed the order would depends on the order the sensors are
configured. However, this is not the case. In particular I am trying this:
call shimmerAnalogSetup.addGyroInputs();
call shimmerAnalogSetup.AddAnExInput(7);

But whatever is in the 4th 16-bit uint of the buffer is not the analog
channel 7.
According to your understanding, should it be the analog channel 7?

Jose.
Post by mike healy
Hi Jose,
I'm not sure if I'm fully understanding your question.
But you might find it helpful to read up on how the ADC on the
MSP430F1611 works, specifically ADC12MCTLx registers and
http://www.ti.com/lit/ug/slau049f/slau049f.pdf).
Then take a look at the implementation of shimmerAnalogSetup
https://github.com/tinyos/tinyos-main/blob/master/tos/platforms/shimmer/shimmerAnalogSetupP.nc
So, the short answer to your question (as I understand it) is that it
depends on the order the sensors were configured with.
Mike
On Wed, Mar 20, 2013 at 2:48 PM, Jose F. Mingorance-Puga
Hello,
I have been trying to figure it out but still cannot come to a conclusion.
I call the command Msp430DmaChannel.repeatTransfer to start a
transfer in the ADC. One of the arguments passed to the method is
a buffer where the quantized data should fall. The problem is, how
can I know in which position of the buffer is each channel of
those I am converting?
In the beginning I just observed manually the contents of the
buffer to guess what channel was in what position, but now I am
reconfiguring the converter in runtime, and I do not know any more
in which position each channel goes. For instance, imagine first I
am sampling gyroscope and accelerometer. Then I disable the
accelerometer and read the analog channel 7. It would be useful to
know how to identify what position of the buffer contains each
channel.
Sincerely,
Jose F. Mingorance-Puga
_______________________________________________
Shimmer-users mailing list
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
mike healy
2013-03-21 11:51:00 UTC
Permalink
Yes, the 4th 16-bit uint should be adc channel 7, assuming you those are
the only sensors you have set.

Specific order is set because all the DMA is doing is transferring the ADC
data, starting at the first argument of the
Msp430DmaChannel.repeatTransfer() function, to the location of the second
argument. The number of ADC result registers transferred depends on the
third argument. The order of which channels corresponds to which ADC memory
location (i.e. ADC12MEMx) is set using the memory control registers (i.e.
the ADC12MCTLx).

I would have to see more of your code to figure out why it isn't behaving
as you expect, but as you are working with an AnEx channel, are you sure
that the PWRMUX bit is not set (and thereby reading the battery voltage
instead of the analog channel exposed to the external connector)?

Mike


On Thu, Mar 21, 2013 at 11:23 AM, Jose F. Mingorance-Puga <
Post by Jose F. Mingorance-Puga
Dear Mike,
The principle of the ADC on the MSP430F1611 and the function ADC12MCTLx
are clear. But none of those implies an specific order of the sampled data
in the buffer when using the command Msp430DmaChannel.repeatTransfer. I
understand the order will depends on how this abstraction of the
hardware/API is dealing with the buffer and the ADC. I have not found
nothing explicitly mentioned about the order of the data.
I guessed the order would depends on the order the sensors are configured.
call shimmerAnalogSetup.addGyroInputs();
call shimmerAnalogSetup.AddAnExInput(7);
But whatever is in the 4th 16-bit uint of the buffer is not the analog
channel 7.
According to your understanding, should it be the analog channel 7?
Jose.
Hi Jose,
I'm not sure if I'm fully understanding your question.
But you might find it helpful to read up on how the ADC on the MSP430F1611
works, specifically ADC12MCTLx registers and sequene-of-channels mode (page
17-12 of the user guide: http://www.ti.com/lit/ug/slau049f/slau049f.pdf).
Then take a look at the implementation of shimmerAnalogSetup (especially
https://github.com/tinyos/tinyos-main/blob/master/tos/platforms/shimmer/shimmerAnalogSetupP.nc
So, the short answer to your question (as I understand it) is that it
depends on the order the sensors were configured with.
Mike
On Wed, Mar 20, 2013 at 2:48 PM, Jose F. Mingorance-Puga <
Post by Jose F. Mingorance-Puga
Hello,
I have been trying to figure it out but still cannot come to a conclusion.
I call the command Msp430DmaChannel.repeatTransfer to start a transfer in
the ADC. One of the arguments passed to the method is a buffer where the
quantized data should fall. The problem is, how can I know in which
position of the buffer is each channel of those I am converting?
In the beginning I just observed manually the contents of the buffer to
guess what channel was in what position, but now I am reconfiguring the
converter in runtime, and I do not know any more in which position each
channel goes. For instance, imagine first I am sampling gyroscope and
accelerometer. Then I disable the accelerometer and read the analog channel
7. It would be useful to know how to identify what position of the buffer
contains each channel.
Sincerely,
Jose F. Mingorance-Puga
_______________________________________________
Shimmer-users mailing list
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
Loading...