Skip to content

Getting "undefined symbol: i2c_smbus_write_byte" inside the .so binary #2

@halfer

Description

@halfer

I am working on a project on a Raspberry Pi 3 that combines a MCP2221 chip with a ST7789V2 LCD panel. The first of these connects to the Pi via USB, and connects to the LCD via a Grove/Stemma wire. I'd like to be able to write graphics primitives to the panel from USB.

I have installed PHP 8.2 on the latest Raspberry Pi OS via the additional "Sury" repo, this seems fine.

I then went through the ext-i2c build steps and I can see i2c in my php -m.

I am using this resource to understand what bytes to send to the LCD panel. I think I need to communicate in raw I2C, but I have very little idea of what I am doing!

I know the LCD device has a default wire address of 0x3e.

For the 0x04 command (get firmware version) I believe I need to send one byte and get back four. I am trying to do it with this code (typed by hand, I don't have a GUI on the Pi):

<?php

$projectRoot = __DIR__;
require_once $projectRoot . '/vendor/autoload.php';

use I2C\Bus as I2CBus;

$busId = 2;
$i2cAddress = 0x3e;

$bus = new I2CBus($busId, $i2cAddress);
echo "Set up bus class\n";

$bus->write(0x04);
$byte0 = $bus->read();
$byte1 = $bus->read();
$byte2 = $bus->read();
$byte3 = $bus->read();
echo "Attempted to read 4 bytes from device\n";

When I run this I get a low-level error:

php: symbol lookup error: /usr/lib/php/20220829/i2c.so: undefined symbol: i2c_smbus_write_byte

Should I try PHP 8.1? Might my ext-i2c build have been defective?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions