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

ModalAI Forum

  1. ModalAI Support Forum
  2. VOXL Compute & Autopilot
  3. VOXL
  4. voxl_i2c_read() function discards first byte from buffer

voxl_i2c_read() function discards first byte from buffer

Scheduled Pinned Locked Moved VOXL
i2cvoxl
4 Posts 3 Posters 1.7k 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.
  • J Offline
    J Offline
    jameskuesel
    Contributor
    wrote on last edited by
    #1

    Hello I am using the libaqp8096 i2c functions https://gitlab.com/voxl-public/voxl-sdk/core-libs/libapq8096-io/-/blob/master/lib/include/voxl_io.h specifically voxl_i2c_read() and voxl_i2c_write(). I am using the voxl read and write functions for reading and writing multiple bytes at a time.

    When I print out the read and write buffers, it looks like it properly writes to the buffer but the results from the read buffer are incomplete. For example, if I write uint8_t wrbuffer = 0x1234 to register address 0x0004, it writes 00 04 12 34 (the first two bytes for the address) and reads back 02 34. Another example: I wrote uint8_t wbuffer[4] = {33,55,77,99} and it read back 01 55 77 99.

    I noticed this issue happens with a write then read. If I read from a read-only buffer, it reads correctly.

    Eric KatzfeyE 1 Reply Last reply
    0
    • J jameskuesel

      Hello I am using the libaqp8096 i2c functions https://gitlab.com/voxl-public/voxl-sdk/core-libs/libapq8096-io/-/blob/master/lib/include/voxl_io.h specifically voxl_i2c_read() and voxl_i2c_write(). I am using the voxl read and write functions for reading and writing multiple bytes at a time.

      When I print out the read and write buffers, it looks like it properly writes to the buffer but the results from the read buffer are incomplete. For example, if I write uint8_t wrbuffer = 0x1234 to register address 0x0004, it writes 00 04 12 34 (the first two bytes for the address) and reads back 02 34. Another example: I wrote uint8_t wbuffer[4] = {33,55,77,99} and it read back 01 55 77 99.

      I noticed this issue happens with a write then read. If I read from a read-only buffer, it reads correctly.

      Eric KatzfeyE Offline
      Eric KatzfeyE Offline
      Eric Katzfey
      ModalAI Team
      wrote on last edited by
      #2

      @jameskuesel What device do you have on the i2c bus?

      J 1 Reply Last reply
      0
      • Eric KatzfeyE Eric Katzfey

        @jameskuesel What device do you have on the i2c bus?

        J Offline
        J Offline
        jameskuesel
        Contributor
        wrote on last edited by
        #3

        @Eric-Katzfey a TOF ranging sensor - VL53L1CB by ST

        1 Reply Last reply
        0
        • James StrawsonJ Offline
          James StrawsonJ Offline
          James Strawson
          ModalAI Team
          wrote on last edited by
          #4

          hmmm, There is a similar (but not exactly the same) behavior with SPI on APQ8096 where all reads are preceded by a single random byte meaning libvoxl-io needs to read one extra byte than expected and then discard the first dummy byte. However this happens under the hood here:

          Link Preview Image
          lib/sdsp/io_rpc_spi.c · master · voxl / Deprecated / libapq8096-io · GitLab

          GitLab.com

          favicon

          GitLab (gitlab.com)

          I've not seen such a thing with I2C. Have you looked at our VL53L1X driver for APQ8096? It might just work with your newer VL53L1CB sensors with small changes.

          Link Preview Image
          voxl / Deprecated / apq8096-rangefinder-server · GitLab

          GitLab.com

          favicon

          GitLab (gitlab.com)

          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