Hey Martin / all,

Had to put this down for a few days but back at it today.

Finally got it working - huzzah!

I changed the c file so that although it's gpio17 it's actually pin 11 (define_SENSOR_SELECT_PIN) and boom!
Why the numbering scheme is so confusing is beyond me but anyway.

Also for us we're running the IC at 5v as well as the 10k resistors on the clock line.

Thanks again Martin - you rock.

Have a great weekend,

Julian


On 3 May 2013 18:17, Martin Peach <martin.peach@sympatico.ca> wrote:
On 2013-05-03 12:34, Julian Brooks wrote:
Ok - thanks for that, makes more sense now.

When I run the C code this happens:

"./jb_d6t_reader_ic3 0
...export file accessed, new pin now accessible
...direction set to output
./jb_d6t_reader_ic3: initialized:0
Write failed (5)
 >> Input/output error <<
...unexport file accessed, pin now inaccessible"

I've done my best to go through the code and make changes where appropriate.

Replaced D6T8L with DRT44L2 and changed packet size.
Altered all references for 2nd sensor to DRT44L2 and also changed i2c-1
to 0 for rev1 board.

Weirdly I can't access the i2c bus anymore?
cat /dev/i2c*
cat: /dev/i2c-0: Input/output error
cat: /dev/i2c-1: Input/output error


Yes I get that too. (unless the sensor returns one byte it's probably normal) But "i2cdetect -y 1" still shows a sensor at 0x0A.
I run the code as "sudo ./d6t_reader 0", otherwise I don't have permission to set the GPIO pin.
I don't get any write errors though.
Are you writing to the correct i2c?
There are two places in the code that could throw the write error. Maybe change the message so you can tell which one it is.
Anyway the setup should work with the old code (only one sensor), the 4051 circuit should have no effect on the communication betwen the Pi and one of the sensors, the select pin select which sensor receives the clock. So if the older code isn't working the circuit is wrong, otherwise the code is buggy.

Martin