error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared

Home Forums Forums Technical Support for BerryGPS and BerryGPS-IMU error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9115
    pmel
    Participant

    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.

    #9119
    Mark Williams
    Keymaster

    it looks like you are missing some libraries

    try installing these

    sudo apt-get install i2c-tools libi2c-dev python-smbus

    Mark --OzzMaker.com --

    #9130
    pmel
    Participant

    Hi 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.

     

    #9153
    Mark Williams
    Keymaster

    Mmmm… 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 again

    Mark --OzzMaker.com --

    #9154
    Mark Williams
    Keymaster

    i forgot to add.. ill need to check to see if something has changed with Raspbian Buster

    Mark --OzzMaker.com --

    #9172
    pmel
    Participant

    Hi 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 files

    I 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!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop…