Hi Mike, Thanks for the quick reply.
But why choose only two buffers, then? Couldn't there potentially be more than one interrupt which would cause sbuf1 to be overwritten as well? --Anders On May 10, 2011, at 5:17 PM, mike healy wrote: Hi Anders, DMA0.RepeatTransfer(...) with sbuf1 when the current buffer is 0 tells the DMA module on the MSP430 to transfer data to sbuf1 next time it runs (which will be the next time shimmerAnalogSetup. triggerConversion() in called in SampleTimer.fired()). DMA0.RepeatTranser() does not move any data around. This is to give the shimmer a chance to send the data from sbuf0 with no fear of it being overwritten by the DMA (which operates in event/interrupt context and so can preempt a task). Mike On Tue, May 10, 2011 at 4:03 PM, Anders Christian Sørensen <[email protected]<mailto:[email protected]>> wrote: Hi, I'm wrapping my head around the BoilerPlate firmware, specifically the call graph and flow of data. So far so good, but I'm curious about the usage of the 'current_buffer' variable. async event void DMA0.transferDone(error_t success) { if(current_buffer == 0){ call DMA0.repeatTransfer((void*)ADC12MEM0_, (void*)sbuf1, nbr_adc_chans); atomic timestamp1 = call LocalTime.get(); //current_buffer = 1; } else { call DMA0.repeatTransfer((void*)ADC12MEM0_, (void*)sbuf0, nbr_adc_chans); atomic timestamp0 = call LocalTime.get(); //current_buffer = 0; } if(nbr_digi_chans > 0) post clockin_result(); else post sendSensorData(); } This is the event handler where it starts. During the first sampling, the DMA0 is setup with 'sbuf0' as destination for the sensor data and 'current_buffer' i 0. Good. Now, when the first sampling is done and the data is ready in the DMA0, this data is accessible through 'sbuf0'. But why does this event handler then call DMA0.RepeatTransfer(...) with 'sbuf1' when 'current_buffer' is 0? To my best knowledge, at this point 'sbuf0' and 'sbuf1' will contain the same data. Am I wrong? Kind regards, Anders _______________________________________________ Shimmer-users mailing list [email protected]<mailto:[email protected]> https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
_______________________________________________ Shimmer-users mailing list [email protected] https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users
