We are running a board with IMP as host controller and some sensors to collect the sensing data. One of the sensor is an Accelerometer, which is supposed to collect samples in multiple of thousands. Because of memory limitation in IMP, we are periodically sending the data to agent. say every 100 samples collected, We upload it to agent.
We are unaware if, wifi stack is running in separate thread or every thing is running sequentially.
For now in our case, when
accelerometer
sampling frequency goes beyond say 800 Hz, my accelerometer says there is overflow in its internal FIFO since its not being read by host
fast enough
. a snippet of code looks like this
`
while(count < this.num_samples)
{
for (i=0;i<other_sreg.len();i++)
{
status = spi_read(other_sreg[i],1)
if ((status[0] & other_sreg_mask[i]) == other_sreg_mask[i] )
{
error+=1;
// petasense_log(" register " + other_sreg[i] + " mask " +other_sreg_mask[i] + "read " +(status[0] ))
}
}
status = spi_read(fifo_sreg,1);
// petasense_log("fifo_ status "+ status[0])
status[0] = status[0] & 0x3f;
if(status[0] > 0)
{
if((num_samples - count) < status[0])
{
status[0] = num_samples - count;
}
count += status[0];
while(status[0]--)
{
read_val();
}
if ((data_x.len()/200)>=1)
{
this.upload_samples();
}
}
}
this.upload_samples();
end_time = get_current_time();
return [data_x,data_y,data_z];
}
`
Is there a possible way to get around this scenario and run the firmware along with meeting the timing requirements. Currently we are looking to scale up the system to
10000 Hz