Can only get MBED application shield to transmit data serially every ~36ms.

27 Feb 2016

I'm trying to read accelerometer data from the accelerometer on board the X-NUCLEO-IKS01A1 MEMS Sensor (http://www.st.com/web/catalog/tools/FM116/SC1248/PF261191) along with the NUCLEO-F401RE development board (http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260000?icmp=nucleo-ipf_pron_pr-nucleo_feb2014&sc=nucleoF401RE-pr).

I'm using the Sensors Reader app found here: https://developer.mbed.org/components/X-NUCLEO-IKS01A1/

I've used both TeraTerm on a Windows PC and CoolTerm on OS X and can only read every 36ms. I need to read much faster than this. I've tried multiple Sensor Shields and Development Boards and still no luck.

Any help on why I can't seem to read faster would be appreciated.

29 Feb 2016

Hi Jacob,

It looks like the Sensor Reader app makes a lot calls to the shield's sensor in the main_cycle function. See line 226 of main.cpp:

ret |= (!CALL_METH(temp_sensor1, GetTemperature, &TEMPERATURE_Value, 0.0f) ? 0x0 : 0x1);
ret |= (!CALL_METH(humidity_sensor, GetHumidity, &HUMIDITY_Value, 0.0f) ? 0x0 : 0x2);;
ret |= (!CALL_METH(pressure_sensor, GetPressure, &PRESSURE_Value, 0.0f) ? 0x0 : 0x4);;
ret |= (!CALL_METH(temp_sensor2, GetFahrenheit, &PRESSURE_Temp_Value, 0.0f) ? 0x0 : 0x8);;
ret |= (!CALL_METH(magnetometer, Get_M_Axes, (int32_t *)&MAG_Value, 0) ? 0x0 : 0x10);;
ret |= (!CALL_METH(accelerometer, Get_X_Axes, (int32_t *)&ACC_Value, 0) ? 0x0 : 0x20);;
ret |= (!CALL_METH(gyroscope, Get_G_Axes, (int32_t *)&GYR_Value, 0) ? 0x0 : 0x40);

If you only care about the accelerometer data, try removing everything except for line 231 (line 6 above). You'll also need to remove the other printf calls starting at line 235 of main.cpp (but keep the accelerometer printf call, the one that starts with "ACC [mg]:")

That should hopefully allow you to speed up the read time. Otherwise, looking through the accelerometer datasheet it looks like you might have to increase the Output Data Rate (ODR) of the accelerometer if you're still having issues getting the speeds you need.

Hope that helps!

Brian