Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. VOXL Compute & Autopilot
  3. VOXL 2
  4. I2C

I2C

Scheduled Pinned Locked Moved VOXL 2
5 Posts 2 Posters 910 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Peter VWP Offline
    Peter VWP Offline
    Peter VW
    wrote on last edited by Peter VW
    #1

    Hello everyone,

    Currently I'm working on the I2C communication with some of our own hardware using the I2C lib from modalai.

    Sending data to our hardware works great and the hardware is acting correctly to it.

    But when we need to read from the hardware the following happens (debugged on hardware):

    • The first message, as expected, come in correctly. The message tells me what I want to read and I set a flag.
    • After the message was read successfully the microcontroller doesn't receive any data anymore.
    • In the terminal of the VOXL2 is an error telling me that it's expecting 12 bytes from slave but received -1 (so, the linux I2C program returns an -1 error)

    When I'm using a terminal program for sending en receiving data from the I2C bus, everything works correctly.

    I use the voxl_i2c_read_bytes library tool like the sourcecode explains.

    We open the I2C connection with voxl_i2c_init and we're using port 0.

    We're running the dev version of the software with the newest system image.

    1 Reply Last reply
    0
    • modaltbM Offline
      modaltbM Offline
      modaltb
      ModalAI Team
      wrote on last edited by
      #2

      Hi @Peter-VW ,

      I believe that voxl_i2c I2C library is VOXL1 specific and you should instead try use more standard open/read/write/close functionality likely.

      I'm assuming you are using the applications processor (i.e. one of the I2Cs from here

      Here's an example from VOXL2, where we are using FLIR Lepton I2C.

      open
      write
      read

      1 Reply Last reply
      0
      • Peter VWP Offline
        Peter VWP Offline
        Peter VW
        wrote on last edited by
        #3

        Thank you for your awnser.

        Since some time there is an repo, and a package in dev, that should be working with the I2C.
        For now what I did last days:

        • Testen with i2cdump (and some other command line commands) the connection. It works perfectly
        • When using the write commando in C everything works correctly.
        • as soon i send the read commando i receive error 107: Transport endpoint is not connected

        Maybe you guys know a fix. I've tried everything I can think off and can find on the internet.

        A part of the read code:

        	ret = write(i2c[bus].fd, &regAddr, 1);
        	if(unlikely(ret!=1)){
        		fprintf(stderr,"ERROR: in corvus_i2c_read_bytes, failed to write to bus\n");
        		i2c[bus].lock = old_lock;
        		return -1;
        	}
            // uint8_t message[1] ;
        
        	ret = read(i2c[bus].fd, data, count);
        	if(unlikely((size_t)ret!=count)){
        		perror("ioctl(I2C_RDWR) in i2c_read");
        		// fprintf(stderr,"ERROR: in corvus_i2c_read_bytes, received %d bytes from device, expected %d\n", ret, (int)count);
        		i2c[bus].lock = old_lock;
        		return -1;
        	}
        

        I used your libio repo for implementation: https://gitlab.com/voxl-public/voxl-sdk/core-libs/libqrb5165-io/-/blob/master/library/src/i2c.c

        1 Reply Last reply
        0
        • modaltbM Offline
          modaltbM Offline
          modaltb
          ModalAI Team
          wrote on last edited by
          #4

          Hi @Peter-VW I believe thats a Work In Progress package (our dev package channel is very untested).

          The example I mentioned above is being used on a drone of ours (using I2C to talk to a FLIR Lepton) so I have more confidence in that approach at this time.

          1 Reply Last reply
          0
          • Peter VWP Offline
            Peter VWP Offline
            Peter VW
            wrote on last edited by
            #5

            @modaltb thank you for your answer.

            For so far I can see my program is the same. I'll take some more indepth look when I'm at work again.

            Is there some .so file I've got to include in my cmakelist?

            I've already tried every possible combination that's out there. Hope we can fix this soon.

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            ModalAI
            Categories Recent Tags ModalAI.com Docs
            © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups