<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hey Martin,<br><br></div>Yes indeed! Blimey. <br><br></div>So I added the localhost ip and changed the i2c port from 1 (rev2 boards) to 0 (rev1) on this line:<br>
sprintf(filename, "/dev/i2c-0");<br></div>Reinstalled libi2c-dev and boom - off it went. Wow.<br><br></div>Still getting some errors though wondering if these are the same ones you previously mentioned with the crc (PEC) checks not working correctly? :<br>
<br>Read failed (5)<br>>> Input/output error <<<br>D6T_checkPEC says 0x8F<br>D6T_checkPEC says 0x52<br>182 140 148 154 156 160 160 162 162 159 166 173 170 172 176 173 172 <0x52><br>d6t44l 182 140 148 154 156 160 160 162 162 159 166 173 170 172 176 173 172<br>
<br><br></div>Data turning up in Pd and I'm quite happy (i.e. a bit delirious:)<br><br></div>Been quite an adventure with all this the last few weeks/month - soldering those tiny pins was well tricky, as was finding some housings!! Also built a couple of custom RPi images as minimal as poss and got quite a lot more oomph out of the cpu. Dipped my toes into C too which is cool - you know I had to search around how to run a C program - './' dur.<br>
</div></div><br></div>Would've been screwed without that C file of yours so thank you Martin.<br><br></div>Julian<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 20 April 2013 22:59, Martin Peach <span dir="ltr"><<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So I tested the 4X4 sensor and it actually works!<br>
Here is the code for a reader that sends to [netreceive 33333], and a receiver patch.<br>
You need to set the IP to that of the machine running Pd, and maybe other settings before compiling, as with the previous version.<span class="HOEnZb"><font color="#888888"><br>
<br>
Martin</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 2013-04-20 17:17, Martin Peach wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Oh sorry, it segfaults if you don't pass an argument at startup. (1 if<br>
it's already initialized, 0 if not)<br>
The line begining "if (argc > 0)" should say "if (argc > 1)".<br>
<br>
Martin<br>
<br>
<br>
On 2013-04-20 13:30, Martin Peach wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Well that looks a total mess...<br>
<br>
I did "sudo apt-get install i2c-dev" before all this, as well as all the<br>
things in <a href="http://www.instructables.com/id/Raspberry-Pi-I2C-Python/#step1" target="_blank">http://www.instructables.com/<u></u>id/Raspberry-Pi-I2C-Python/#<u></u>step1</a><br>
except I didn't use any python.<br>
The segfaults might be because you are asking for more than 32 bytes in<br>
a read, or something wrong in the code, the listing below looks like it<br>
goes wrong right at the beginning.<br>
<br>
<br>
Martin<br>
<br>
On 2013-04-19 17:37, Julian Brooks wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As I'm new to all this C stuff I just had a look inside the 'hello' file<br>
and there's a few bits in there which may be of interest:<br>
^@D6T_checkPEC says 0x%02X<br>
(which I think is ok from looking at the code?)<br>
then it all goes wrong<br>
^@^@^@Unable to create socket (%d)<br>
^@^@^@>> %s <<<br>
^@^@^@<a href="http://127.0.0.1" target="_blank">127.0.0.1</a> <<a href="http://127.0.0.1" target="_blank">http://127.0.0.1</a>>^@^@^@Unable to make address from %s<br>
^@%s: initialized:%d<br>
^@/dev/i2c-0^@^@Failed to open the bus. (%d)<br>
^@^@^@Failed to acquire bus access and/or talk to slave. (%d)<br>
^@^@^@^@Write failed (%d)<br>
^@^@Read failed (%d)<br>
^@^@^@%d ^@<0x%02X><br>
^@^@^@d6t8l^@^@^@ %d^@<br>
^@^@^@sendto error (%d)<br>
<br>
BTW - I've removed libi2c-dev again and will leave it that way for now.<br>
<br>
Going to stop now but will be back tomorrow.<br>
<br>
Cheers,<br>
<br>
Julian<br>
<br>
<br>
<br>
<br>
<br>
On 19 April 2013 22:07, Julian Brooks <<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>> wrote:<br>
<br>
Edited your original file and all I changed was the ip address to<br>
127.0.0.1 and still seg fault (double checked /etc/hosts too).<br>
<br>
Also tried reinstalling libi2c-dev and then running 'hello' - same.<br>
<br>
<br>
On 19 April 2013 21:54, Julian Brooks <<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>> wrote:<br>
<br>
hmmm - both files:<br>
./hello-2<br>
Segmentation fault<br>
<br>
Try again...<br>
<br>
<br>
<br>
On 19 April 2013 21:51, Julian Brooks <<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>> wrote:<br>
<br>
Ok -found I had to remove 'libi2c-dev'.<br>
<br>
Then builds.<br>
<br>
More soon...<br>
<br>
<br>
On 19 April 2013 21:28, Julian Brooks <<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>> wrote:<br>
<br>
Hey Martin,<br>
<br>
When I try to compile hello.c I get:<br>
gcc -o hello hello.c<br>
In file included from hello.c:8:0:<br>
/usr/include/linux/i2c-dev.h:<u></u>38:8: error: redefinition<br>
of 'struct i2c_msg'<br>
/usr/include/linux/i2c.h:67:8: note: originally<br>
defined here<br>
/usr/include/linux/i2c-dev.h:<u></u>90:7: error: redefinition<br>
of 'union i2c_smbus_data'<br>
/usr/include/linux/i2c.h:125:<u></u>7: note: originally defined<br>
here<br>
<br>
Dunno if this is at all relevant but maybe this is a<br>
good time to say I have a rev1 RPi so I'm on i2c 0<br>
not 1.<br>
The Pi install is very up to date though, including<br>
recent runs of hexxeh's 'rpi-update' tool so all the<br>
system's fresh.<br>
<br>
I did attempt to change the number of bytes to be read<br>
which perhaps would explain why the .h file's are<br>
complaining but I don't understand it for your version<br>
which is 'as-is'?<br>
<br>
In fact why don't I attach the notes I've made of the<br>
changes to the c file you sent. Was vaguely hoping I<br>
might be able to say 'ta da' but have fallen at the 1st<br>
fence:( bugger.<br>
<br>
Julian<br>
<br>
<br>
<br>
<br>
<br>
On 19 April 2013 19:51, Julian Brooks <<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>> wrote:<br>
<br>
Hi Martin,<br>
<br>
Meant to add re setting baud rate:<br>
I've been making use of the gpio utility that comes<br>
with wiringPi<br>
<br>
<a href="https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/" target="_blank">https://projects.drogon.net/<u></u>raspberry-pi/wiringpi/the-<u></u>gpio-utility/</a><br>
Very handy for getting a quick visualisation of the<br>
current state of all the pins and also easy-access<br>
to setting the baud rate too (amongst other stuff).<br>
<br>
Julian<br>
<br>
<br>
On 19 April 2013 14:36, Martin Peach<br>
<<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a><br>
<mailto:<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@<u></u>sympatico.ca</a>>> wrote:<br>
<br>
Hi Julian,<br>
Yes I've been messing with coding it in c on the<br>
pi and sending the data to a [netreceive] in a<br>
Pd patch on another machine. I'm attaching the<br>
source code for the pi part and the Pd patch.<br>
The code can be compiled on the pi with<br>
gcc -o hello hello.c<br>
You need to set the IP address of the receiving<br>
machine in the code (I have 192.168.2.15, it<br>
could be 127.0.0.1 for the same machine).<br>
I tried changing the baud rate with<br>
sudo modprobe -r i2c_bcm2708<br>
sudo modprobe i2c)bcn2708 baudrate=90000<br>
but it works fine at the default 100000.<br>
It seems that you only need to write the command<br>
once, after that simply reading gets you another<br>
packet. Using a combined write/read operation<br>
only works half the time, as I also found on the<br>
Arduino. All you need to do is write the 0x4C<br>
command once, wait a millisecond or so and then<br>
read it.<br>
Another issue is that I tried this with the 8X1<br>
sensor, not the 4X4 one, so the code reads 19<br>
bytes (need to change the expected read size in<br>
the code). The 4X4 sensor sends 35 bytes which<br>
is 3 more than the i2c driver maximum, so you<br>
may not get the last part of a packet.<br>
I'll try it later with a 4X4 sensor to see what<br>
happens.<br>
<br>
Martin<br>
<br>
<br>
On 2013-04-19 07:01, Julian Brooks wrote:<br>
<br>
Hi Martin,<br>
<br>
Did you manage to make any progress with the<br>
sensor on the Pi?<br>
I also wanted to ask whether the output<br>
we're receiving from i2cdump<br>
makes any sense to you as it doesn't to us<br>
currently? Tried searching<br>
around for possible info on the 'XX' & 'ff'<br>
but drawing a blank here.<br>
<br>
Cheers,<br>
<br>
Julian<br>
<br>
<br>
On 13 April 2013 01:11, Julian Brooks<br>
<<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>>> wrote:<br>
<br>
Hey all,<br>
<br>
Some success finally:<br>
<br>
Hurrah!!<br>
<br>
The scl breakout pin on the pi proto<br>
plate wasn't working properly.<br>
<br>
When unscrewed halfway it works, when<br>
fully screwed in it doesn't.<br>
<br>
So - now got this:<br>
<br>
i2cdetect -y 0<br>
<br>
0 1 2 3 4 5 6 7 8 9 a b c d e f<br>
<br>
00: -- -- -- -- -- -- -- 0a -- -- --<br>
-- --<br>
<br>
10: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
20: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
30: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
40: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
50: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
60: -- -- -- -- -- -- -- -- -- -- -- --<br>
-- -- -- --<br>
<br>
70: -- -- -- -- -- -- -- --<br>
<br>
and<br>
<br>
i2cdump -y 0 0xa<br>
No size specified (using byte-data<br>
access)<br>
<br>
Gives a whole host of stuff I don't yet<br>
understand but I don't care<br>
currently as something is actually<br>
happening.<br>
<br>
Will figure out a way of saving the<br>
console info (any hints<br>
anyone?) as it gets badly mangled when<br>
cutting and pasting but<br>
basically something like this:<br>
<br>
i2cdump -y 0 0xa<br>
No size specified (using byte-data<br>
access)<br>
0 1 2 3 4 5 6 7 8 9 a<br>
b c d e<br>
f 0123456789abcdef<br>
00: ff XX XX XX XX XX XX ff XX XX XX XX<br>
ff ff ff XX .XXXXXX.XXXX...X<br>
10: XX ff XX XX XX XX XX ff XX ff XX ff<br>
XX XX ff XX X.XXXXX.X.X.XX.X<br>
20: ff XX XX ff XX XX ff XX XX XX XX ff<br>
XX XX XX ff .XX.XX.XXXX.XXX.<br>
30: XX ff XX ff XX XX XX XX ff ff ff XX<br>
XX XX XX XX X.X.XXXX...XXXXX<br>
40: XX XX XX ff XX ff XX XX XX 64 XX XX<br>
d5 XX XX ff XXX.X.XXXdXX?XX.<br>
50: XX ff XX XX XX XX XX XX XX ff XX XX<br>
ff XX XX XX X.XXXXXXX.XX.XXX<br>
60: ff XX XX XX ff XX XX XX XX XX XX XX<br>
XX ff XX XX .XXX.XXXXXXXX.XX<br>
70: XX XX XX XX XX XX XX ff XX XX XX XX<br>
XX XX XX XX XXXXXXX.XXXXXXXX<br>
80: XX ff XX XX ff ff XX XX XX ff XX XX<br>
XX XX XX XX X.XX..XXX.XXXXXX<br>
90: XX XX ff XX XX ff XX ff XX ff ff XX<br>
XX ff ff XX XX.XX.X.X..XX..X<br>
a0: XX ff XX XX ff XX XX XX XX XX XX XX<br>
XX XX ff XX X.XX.XXXXXXXXX.X<br>
b0: XX XX ff XX XX XX ff XX XX ff XX XX<br>
XX XX XX XX XX.XXX.XX.XXXXXX<br>
c0: XX XX XX XX ff XX XX ff ff XX XX ff<br>
ff XX XX XX XXXX.XX..XX..XXX<br>
d0: XX XX XX XX XX ff XX ff XX XX XX XX<br>
XX ff XX ff XXXXX.X.XXXXX.X.<br>
e0: XX XX XX ff XX ff XX XX XX XX XX XX<br>
XX XX ff XX XXX.X.XXXXXXXX.X<br>
f0: ff XX ff ff XX XX XX XX XX XX XX XX<br>
XX XX ff XX .X..XXXXXXXXXX.X<br>
<br>
<br>
Progress at least.<br>
<br>
Cheers,<br>
<br>
Julian<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 12 April 2013 11:27, Julian Brooks<br>
<<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>>> wrote:<br>
<br>
Message resent for thread archives<br>
with smaller picture size.<br>
<br>
Julian<br>
<br>
---------- Forwarded message<br>
----------<br>
From: *Julian Brooks*<br>
<<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a><br>
<mailto:<a href="mailto:jbeezez@gmail.com" target="_blank">jbeezez@gmail.com</a>>>><br>
Date: 11 April 2013 19:24<br>
Subject: Re: [PD] Sensors GPIO<br>
Raspberry Pi Pd<br>
To: Martin Peach<br>
<<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a><br>
<mailto:<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@<u></u>sympatico.ca</a>><br>
<mailto:<a href="mailto:martin.peach@" target="_blank">martin.peach@</a>__<a href="http://sympatico.ca" target="_blank">sympati<u></u>co.ca</a><br>
<mailto:<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@<u></u>sympatico.ca</a>>>><br>
Cc: PD List <<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a><br>
<mailto:<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a>><br>
<mailto:<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a><br>
<mailto:<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a>>>><br>
<br>
<br>
Hey Martin / list,<br>
<br>
Finally got all the stuff and ...<br>
<br>
It’s not working!<br>
<br>
We spent the day soldering cables<br>
and connecting stuff up as per<br>
the Omron ‘App Note 01’ spec sheet.<br>
<br>
Started off super-conservative<br>
using the I2C level converter<br>
(case 3 page 4)<br>
<br>
<a href="http://www.adafruit.com/__products/757#Blog/Flickr" target="_blank">http://www.adafruit.com/__<u></u>products/757#Blog/Flickr</a><br>
<br>
<<a href="http://www.adafruit.com/products/757#Blog/Flickr" target="_blank">http://www.adafruit.com/<u></u>products/757#Blog/Flickr</a>><br>
<br>
We tried resistors on both sides<br>
(being super paranoid!) and<br>
then we took the low (Pi) side<br>
ones off.<br>
<br>
We then moved on to case 2 page 3<br>
of this same document…<br>
<br>
At each stage we checked with<br>
“I2Cdetect –Y 1” and nothing was<br>
visible.<br>
<br>
The grid shows no attached devices<br>
every time we run it.<br>
<br>
We re-booted at every stage<br>
following the various online<br>
tutorials/methods of setting up I2C<br>
GPIO on the Pi (checked &<br>
double checked).<br>
<br>
<br>
As you can see we’re using a pi<br>
protoplate:<br>
<br>
<a href="https://www.adafruit.com/__products/801" target="_blank">https://www.adafruit.com/__<u></u>products/801</a><br>
<<a href="https://www.adafruit.com/products/801" target="_blank">https://www.adafruit.com/<u></u>products/801</a>><br>
<br>
In the photo I’ve attached the<br>
cables are coded as follows:<br>
<br>
Orange GND<br>
<br>
Yellow 5v<br>
<br>
Blue SCL<br>
<br>
Green SDA<br>
<br>
The white is also 5v for the pull<br>
up resistors.<br>
<br>
The resistor values are 4.7k btw.<br>
<br>
We have tested the cable that<br>
terminates at the sensor and all<br>
that is OK.<br>
<br>
I put a multimeter on the GND and<br>
SDA solder points on the<br>
sensor itself and got 3.7v…<br>
<br>
I put a multimeter on the GND and<br>
SCL solder points on the<br>
sensor itself and got 0.0v…<br>
<br>
Don’t know if this means anything<br>
or could be useful to know!<br>
<br>
Stuck and frustrated now but hey, 3<br>
weeks ago I knew absolutely<br>
bugger all about any of this and<br>
now I do (sort of).<br>
<br>
I'm thinking we could do with the<br>
most basic i2c sensor we can<br>
find as we have nothing to compare.<br>
<br>
Tonight I'm going to d/l a fresh<br>
raspbian and start from scratch<br>
to check that end.<br>
<br>
Feel like if we can't get past the<br>
'i2c-tools' tests we're<br>
screwed - never mind getting it in<br>
and out of Pd.<br>
<br>
Any thoughts/pointers/options from<br>
anyone will be really<br>
appreciated?<br>
<br>
<br>
Cheers,<br>
<br>
<br>
Julian<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
______________________________<u></u>___________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> <mailto:<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a>><br>
mailing list<br>
UNSUBSCRIBE and account-management -><br>
<br>
<a href="http://lists.puredata.info/__listinfo/pd-list" target="_blank">http://lists.puredata.info/__<u></u>listinfo/pd-list</a><br>
<<a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a>><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -><br>
<a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -><br>
<a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a><br>
<br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -><br>
<a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a><br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>