Inconsistent I2C SCL frequency ? - Raspberry Pi Forums


found rpi3 puzzling behaviour , input.
when repeatedly running .py script see i2c scl freq change without reason.
tried find similar post on forum, not quite see closely related.

tasks not simpler:
reading register mcp9808 temp sensor , ie single i2c bus access @ 100khz.
on mcp9808 scl defined input , no clock stretching comes play.
hw bits, incl. bus soundly implemented (short bus clk / sda rise time <250 nsec)
no other application running on pi except python 2.7 i2c code, no load on pi.
turned off wifi , bt disabled
tried on 2 pi hw (both rpi3) both exhibits same exact scl issue
tried wiring pi , serbus modules
q: why scl freq randomly swap between 100khz , 62.5khz
there no bus error (write or read fault) , inconsistent behaviour of scl :
statistically 70% of time stays on 62.5khz , 30% @ 100khz , 1% shows 'mixed' clk rate
mixed mean , writes register @ 62.5khz , (in 35 microsecs) reads 2 bytes time @ 100 khz clk rate
see illustrations (all scope time base = 100 microsec / div).
comment please.

code: select all

# using wiringpi python wrapper -- i2c mcp9808   import wiringpi  import time   mcp9808 = 0x18		# mcp9808 bus address  temp_reg = 0x05		# ambient temperature register address   bus_state = wiringpi.wiringpii2csetup(mcp9808)		#run standard i2c setup   	 amb_temp = wiringpi.wiringpii2creadreg16(bus_state,temp_reg)  	# reads 2 bytes int "amb_temp" 	 print ('ambient temp = 0x{0:04x}'.format(amb_temp))



raspberrypi



Comments