Home › Forums › Forums › Technical Support for BerryIMU › [Resolved]Unable to open I2C bus
- This topic has 35 replies, 3 voices, and was last updated 8 years, 6 months ago by jawood.
- AuthorPosts
- May 12, 2015 at 5:21 pm #3937jawoodParticipant
Connected new BerryIMU to Raspberry Pi 2 with PiScreen on SanDisk Extreme 32Gig.
Installed piscreen image 1.8
raspi-config
– advanced settings – update – Expand file system – change password – change international settings – change host name – rebootrpi-update
– rebootapt-get update
apt-get upgrade
– rebootsudo apt-get install i2c-tools libi2c-dev
sudo nano /etc/modules
– add i2c-dev, i2c-bcm2708sudo nano /boot/config.txt
– add dtparam=i2c_arm=on, dtparam=i2c1=on
-rebootsudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — 1e —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — — — 6a — — — — —
70: — — — — — — — 77git clone https://github.com/mwilliams03/BerryIMU.git
gcc compass_tutorial01.c -o compass_tutorial01 -lm
./compass_tutorial01
– Unable to open I2C bus!P.S. Of course I still have the problem with the touch screen calibration too!
May 13, 2015 at 5:20 am #3945Mark WilliamsKeymasterMay 13, 2015 at 9:06 am #3947jawoodParticipant🙂 that worked.
May 13, 2015 at 10:34 am #3954jawoodParticipantok so that’s all good now moving onto the next issue…
Doing the compass calibration tutorial 03
Create text file with sudo ./compass_tutorial01 > rawdatauncalibrated.txt no problems
Remove first and last line with awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt I get
– awk: 1: unexpected character 0xe2 (Even if I go into a text editor and remove 1st and last lines and any data that is not formatted correctly, I get the same error when running this command.)May 13, 2015 at 10:43 am #3956jawoodParticipantrawdatauncalibrated.txt is the piped output
and
rawdatauncalibrated-1.txt is after I have manually edited the file and removed all erroneous data.
When run
awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt
or
awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated-1.txt
get same error
awk: 1: unexpected character 0xe2Attachments:
May 13, 2015 at 10:54 am #3959jawoodParticipantWhen trying to plot data with Mathematica
data = Import [“~/calibrated-1.txt”, “Table”, “FieldSeparators” -> {“,”, ” “}];
ListPlot[data[[All, {6, 9}]], AspectRatio -> 1, Frame -> True]Import::nffil : File not found during import.
even if I do this
data = Import [“/home/pi/BerryIMU/compass_tutorial01_basics/calibrated-1.txt”, “Table”, “FieldSeparators” -> {“,”, ” “}];
ListPlot[data[[All, {6, 9}]], AspectRatio -> 1, Frame -> True]May 13, 2015 at 11:20 am #3962Mark WilliamsKeymasterI tested the above syntax with your data and it works. See image below.
1.check the location of your data file
2.check the permissions on your data fileMark --OzzMaker.com --
May 13, 2015 at 11:23 am #3963jawoodParticipantok I got that to work now and can display un-calibrated plot graph.
when compiling compass_tutorial03.c after modifying calibration data I get errorpi@INS-RPi2-01 ~/BerryIMU/compass_tutorial03_calibration $ gcc -o compass_tutorial03 compass_tutorial03.c
/tmp/ccwU8pZV.o: In function `main’:
compass_tutorial03.c:(.text+0x354): undefined reference to `atan2′
collect2: ld returned 1 exit statusYou were right though, it was just file name and paths incorrect.
May 13, 2015 at 11:26 am #3964jawoodParticipantAttached is copy of compass_tutorial03.c that I have after changing the calibration data variables.
Attachments:
May 13, 2015 at 11:40 am #3967Mark WilliamsKeymastercompile with;
gcc -o compass_tutorial03_calibration compass_tutorial03_calibration.c -lm
-lm was missing on the instruction page.. sorry about that
Mark --OzzMaker.com --
May 13, 2015 at 11:53 am #3971jawoodParticipantthanks that’s got that sorted, now onto tutorial 4…
May 13, 2015 at 11:59 am #3972jawoodParticipantOk so I dod the SDL install
sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-ttf2.0-devsudo nano test.c
copy
#include <SDL/SDL.h>
int main(int argc, char** argv) {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface *screen;screen = SDL_SetVideoMode( 480, 320, 16, SDL_SWSURFACE );
SDL_Rect rect;
rect.x = 10;
rect.y = 10;
rect.w = 20;
rect.h = 20;Uint32 color = SDL_MapRGB(screen->format, 0xff,0xff,0xff);
Uint32 color2 = SDL_MapRGB(screen->format, 0,0,0);
SDL_FillRect(screen, &screen->clip_rect, color);
SDL_Flip(screen);
getchar();SDL_Quit();
return 0;
}gcc -o test test.c
sdl-config –cflags
sdl-config –libs
Get error:-
Usage: sdl-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–libs] [–static-libs]
Usage: sdl-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–libs] [–static-libs]
/tmp/ccM8y3Uh.o: In function `main’:
test.c:(.text+0x18): undefined reference to `SDL_Init’
test.c:(.text+0x2c): undefined reference to `SDL_SetVideoMode’
test.c:(.text+0x6c): undefined reference to `SDL_MapRGB’
test.c:(.text+0x8c): undefined reference to `SDL_MapRGB’
test.c:(.text+0xa8): undefined reference to `SDL_FillRect’
test.c:(.text+0xb0): undefined reference to `SDL_Flip’
test.c:(.text+0xb8): undefined reference to `SDL_Quit’
collect2: ld returned 1 exit statusOw and thanks for all your help so far
May 13, 2015 at 12:27 pm #3974Mark WilliamsKeymasterlink sdl by adding
-lSDL
to the end of the compile statement.Mark --OzzMaker.com --
May 13, 2015 at 12:49 pm #3976jawoodParticipantThankyou again that got it going.
Now im doing the Inclinometer when I do thisgcc -o gyro_accelerometer_tutorial02 -lm gyro_accelerometer_tutorial02.c
sdl-config –cflags
sdl-config –libs
-lSDL_image -lSDL_gfxI get
Usage: sdl-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–libs] [–static-libs]
Usage: sdl-config [–prefix[=DIR]] [–exec-prefix[=DIR]] [–version] [–cflags] [–libs] [–static-libs]
gyro_accelerometer_tutorial02.c:25:17: fatal error: SDL.h: No such file or directory
compilation terminated.May 14, 2015 at 1:48 am #3979Mark WilliamsKeymasterI am not near a Pi at the moment… but can you try again with
-SDL
at the end. Let me know how you goMark --OzzMaker.com --
- AuthorPosts
- You must be logged in to reply to this topic.