Home › Forums › Forums › Technical Support for BerryGPS and BerryGPS-IMU › error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared
Tagged: BerryGPS-IMU
- This topic has 5 replies, 2 voices, and was last updated 4 years, 1 month ago by pmel.
- AuthorPosts
- August 5, 2019 at 1:01 pm #9115pmelParticipant
Hello,
I have a BerryGPS-IMUv3, Raspberry Pi 3B+, running Raspbian Buster full (2019-07-10).
GPS module works fine.
sudo i2cdetect -y 1 – shows 1C, 6A and 77.I have followed the guides including this https://github.com/ozzmaker/BerryIMU/issues/8 . However, when compiling gyro_accelerometer_tutorial02.c I get the following error : IMU.c:143:14: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)
__u16 block[I2C_SMBUS_BLOCK_MAX];N.B. The readme says that v1 and v2 are supported, implication that v3 is NOT supported, is this correct?
Any guidance greatly appreciated.
August 5, 2019 at 2:59 pm #9119Mark WilliamsKeymasterit looks like you are missing some libraries
try installing these
sudo apt-get install i2c-tools libi2c-dev python-smbus
Mark --OzzMaker.com --
August 6, 2019 at 12:02 am #9130pmelParticipantHi Mark,
Firstly, many thanks for your speedy response and support.
I ran the command / installed the packages you specified, however, it did not resolve the error!
Here is the output, also I have attached a screenshot of the shell. Any further ideas please?
$ sudo apt-get install i2c-tools libi2c-dev python-smbus
Reading package lists… Done
Building dependency tree
Reading state information… Done
i2c-tools is already the newest version (4.1-1).
libi2c-dev is already the newest version (4.1-1).
python-smbus is already the newest version (4.1-1).
The following package was automatically installed and is no longer required:
rpi.gpio-common
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.Attachments:
August 6, 2019 at 12:55 pm #9153Mark WilliamsKeymasterMmmm… strange.
do you have this file?
/usr/include/linux/i2c-dev.h
can you show me the output of this command
dpkg -l libi2c-dev
Also try this header file..
1. go into the directory where the code is
2. download this older header file
wget ozzmaker.com/downloads/i2c-dev.h
3. open IMU.c and change this line;
#include "linux/i2c-dev.h"
to this
#include "i2c-dev.h"
4. try to compile againMark --OzzMaker.com --
August 6, 2019 at 12:56 pm #9154Mark WilliamsKeymasteri forgot to add.. ill need to check to see if something has changed with Raspbian Buster
Mark --OzzMaker.com --
August 6, 2019 at 11:59 pm #9172pmelParticipantHi Mark,
Again, many thanks for your speedy response and support, it’s very much appreciated!
To answer your questions;
I do have just 1 i2c-dev.h (I did use “find” to search the entire file-system), ls -l
-rw-r–r– 1 root root 2612 Dec 3 2018 /usr/include/linux/i2c-dev.h
Interestingly, and I think related, is this post, https://raspberrypi.stackexchange.com/questions/37689/how-do-i-use-the-i2c-bus, As can be seen from the “ls -l”, i2c-dev.h with “Raspbian Buster” is 2612 in size, the download you suggest is 11507!
-rw-r–r– 1 pi pi 11507 Aug 6 03:49 i2c-dev.h
$ dpkg -l libi2c-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-===================================================
ii libi2c-dev 4.1-1 armhf userspace I2C programming library development filesI followed your re-compile instructions, and THAT WORKED! many thanks.
I have a suspicion / intuition, that this issue is related to the “Rasbian Buster” build / install, PLEASE let us know what you find?
Again, many thanks!
- AuthorPosts
- You must be logged in to reply to this topic.