Samplings frequency I2C bus

Hi, i have a pixhawk where i have connected a Fast-Response temp sensor and Bar02 sensor to the I2C bus and running ArduSub. From the datalog i see that the sampling frequency is farily low, approx 10 Hz.Is this correct? Is there any way I can increase the sampling frequency on the I2C bus? what is the maximum?

Hi,

The I²C clock frequency is 400KHz, and the sensor can handle it, but ArduSub do a sample of this sensor at 50Hz for the intern algorithms. If you aim to change the log frequency, you can use SRn parameters.

Hi and thank you for the reply. But isn’t the SRn parameter for stream rate to ground station? I see the range here is set to 1-10 Hz.

Reading our SD card logged data we see that the actual sampling frequency is apporximately 10 Hz. You say the sensors on the I2C bus is sampled in a 50Hz algorithm. Is this the fifty_hz_loop()? Could you tell me where the call is made for reading the bus? Would it be possible to change this call to a faster loop? the 100Hz loop or the 400 hz main loop?

Thank you in advance.

maybe i was not specific enough, but this issue is related to logging to the SD card.

Hi,

Oh, it was not clear to me that you want from the SD card in your first post, sorry for that.

To perform this, it’s necessary to do modifications in ArduSub source code.
You should check the DataFlash_Class::Log_Write_Baro function and use it in the thread with the frequency that you would like.

Take in mind that logging at a faster rates in the SD card will use more processor time from other tasks. Be aware that may cause performance problems.

thank you very much, we will look into it.