Fola Alamudun
2013-02-28 04:28:52 UTC
I'm modifying hosttimelogging to include gsr data as well as accelerometer.
I seem to be having a problem with chunks of missing data.
I started of with a version of hosttimelogging that collects gsr_raw and
gsr_res with a timestamp at the beginning of the file.
When I add accelerometer x, y, and z, the output i get seems to be missing
about 7s of data periodically.
Bellow is a snippet of the portion i feel may have a problem:
void autorange_gsr() {
uint8_t current_active_resistor = active_resistor;
if(current_buffer == 0) {
active_resistor = call Gsr.controlRange(*(sbuf0 +
(dma_blocks*NUM_ADC_CHANS-1)), active_resistor);
*(sbuf0 + (dma_blocks*NUM_ADC_CHANS-1)) |= (current_active_resistor
<< 14);
}
else {
active_resistor = call Gsr.controlRange(*(sbuf1 +
(dma_blocks*NUM_ADC_CHANS-1)), active_resistor);
*(sbuf1 + (dma_blocks*NUM_ADC_CHANS-1)) |= (current_active_resistor
<< 14);
}
}
async event void DMA0.transferDone(error_t success) {
dma_blocks++;
autorange_gsr();
atomic DMA0DA += 8;
// flash the green led approx. once every two seconds
if(!(dma_blocks%20))
call Leds.led2On();
else
call Leds.led2Off();
if((dma_blocks+1) * NUM_ADC_CHANS > 510){
dma_blocks = 0;
if(current_buffer == 0){
call DMA0.repeatTransfer((void *)ADC12MEM0_, (void *)sbuf1,
NUM_ADC_CHANS);
current_buffer = 1;
}
else {
call DMA0.repeatTransfer((void *)ADC12MEM0_, (void *)sbuf0,
NUM_ADC_CHANS);
current_buffer = 0;
}
post store_contents();
}
}
Any help will be greatly appreciated. thanks.
*"Nothing will benefit human health and increase chances for survival of
life on Earth as much as the evolution to a vegetarian diet." ~ Albert
Einstein (1879 - 1955).
Fola Alamudun
Computer Engineering
Texas A&M University
mobile: 469-995-4088 | email: ***@tamu.edu*
I seem to be having a problem with chunks of missing data.
I started of with a version of hosttimelogging that collects gsr_raw and
gsr_res with a timestamp at the beginning of the file.
When I add accelerometer x, y, and z, the output i get seems to be missing
about 7s of data periodically.
Bellow is a snippet of the portion i feel may have a problem:
void autorange_gsr() {
uint8_t current_active_resistor = active_resistor;
if(current_buffer == 0) {
active_resistor = call Gsr.controlRange(*(sbuf0 +
(dma_blocks*NUM_ADC_CHANS-1)), active_resistor);
*(sbuf0 + (dma_blocks*NUM_ADC_CHANS-1)) |= (current_active_resistor
<< 14);
}
else {
active_resistor = call Gsr.controlRange(*(sbuf1 +
(dma_blocks*NUM_ADC_CHANS-1)), active_resistor);
*(sbuf1 + (dma_blocks*NUM_ADC_CHANS-1)) |= (current_active_resistor
<< 14);
}
}
async event void DMA0.transferDone(error_t success) {
dma_blocks++;
autorange_gsr();
atomic DMA0DA += 8;
// flash the green led approx. once every two seconds
if(!(dma_blocks%20))
call Leds.led2On();
else
call Leds.led2Off();
if((dma_blocks+1) * NUM_ADC_CHANS > 510){
dma_blocks = 0;
if(current_buffer == 0){
call DMA0.repeatTransfer((void *)ADC12MEM0_, (void *)sbuf1,
NUM_ADC_CHANS);
current_buffer = 1;
}
else {
call DMA0.repeatTransfer((void *)ADC12MEM0_, (void *)sbuf0,
NUM_ADC_CHANS);
current_buffer = 0;
}
post store_contents();
}
}
Any help will be greatly appreciated. thanks.
*"Nothing will benefit human health and increase chances for survival of
life on Earth as much as the evolution to a vegetarian diet." ~ Albert
Einstein (1879 - 1955).
Fola Alamudun
Computer Engineering
Texas A&M University
mobile: 469-995-4088 | email: ***@tamu.edu*