18X i2c

tiscando

Senior Member
I know the 18X is now totally yesteryear but I still have some lying around, and I'm sure others will.

I had difficulty interfacing an i2c pressure sensor with an 18X (firmware v8.8), and read about others on the forum reporting similar problems in the past. I probed the SDA and SCL lines with a scope (oscilloscope) and noticed an unusual blip before the start condition. I then tried the same code on the 18M2 and it gave a much better i2c signal, without any blips.

The sensor's datasheet quoted the i2c address of 0x28, so I tried both 0x28 and 0x50 on both PICAXES. The slave address is actually 0x50 in the hi2csetup command, i.e. 0x28 left-shifted by 1, so this is an important point for those trying to use 3rd party i2c devices.

The i2c sensor only worked with the 18M2, not the 18X, probably because:
1) the Blip before the start condition confused the sensor,
2) and the 18X's i2c actually ran slower at 33kHz, and in the 'absolute maximum' section in the datasheet, it strangely said the minimum i2c speed is 100kHz (and the max is 400kHz as expected). 33kHz could have been too slow.

Attached are the waveforms I have captured from the 18X and 18M2, without the sensor connected (the sensor is currently wired into a pump controller circuit and working).


Code:
#no_data

hi2csetup i2cmaster, 0x50, i2cslow, i2cbyte

main: 
	hi2cin (b3, b2)            'no address byte needed
	sertxd (#w1, 13, 10)
	pause 490
	goto main
 

Attachments

westaust55

Moderator
What pressure sensor are you using (link to Datasheet may be useful)?

I have used the 18X with i2c comms to HopeRF pressure sensors and other items.

If i2c speed if a possible cause of the problem, have you tried running the 18X at 8MHz?
May not double the data throughput but may speed it up somewhat.
 

Buzby

Senior Member
... in the datasheet, it strangely said the minimum i2c speed is 100kHz ...
I'm always a bit wary about running I2C slower than the minimum shown, usually 100KHz.

Some slaves are designed to automatically reset their I2C state if they detected spurious signals or gaps.

Running much below 100KHz may make the gaps too big, and so the slave resets.

This is not to say that every slave behaves like this, but it is not always clear from the datasheet.
 

westaust55

Moderator
The datasheet gave very little other information on the i2c side, but here it is anyway: http://sensing.honeywell.com/index.php/ci_id/45330/la_id/1/
The Honeywell pressure sensors in that datasheet are analogue output (not i2c).

I found this Honeywell Tech Note on i2c comms with their pressure sensors
http://sensing.honeywell.com/i2c comms digital output pressure sensors_tn_008201-3-en_final_30may12.pdf
but that is not for a specidic sensor.
And this sheet covers the ADSX series with i2c/SPI interfaces.
http://sensing.honeywell.com/honeywell-sensing-asdx series-digital-pressure-sensors-product-sheet-008095-11-en.pdf

EDIT:
Under the i2c specification (see page 48)
for both the normal/standard mode (max clock speed = 100 kHz) and fast mode (max 400 kHz) the minimum clock speed is 0 kHz.
If the slave device is not capable of working at very low clock speeds then the root cause is the slave device, not the master (= PICAXE) device.

But that does not exlain the "Blip" you see for the 18X signal or why it affects the honeywell pressure sensor but not for example the HopeRF sensor that I used..
 
Last edited:
Top