Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c:transfer exception #29

Open
guachong133 opened this issue Nov 13, 2023 · 0 comments
Open

i2c:transfer exception #29

guachong133 opened this issue Nov 13, 2023 · 0 comments

Comments

@guachong133
Copy link

guachong133 commented Nov 13, 2023

hi its really a wonderful tool but I meet the following error when running i2c test:

local I2C = require('periphery').I2C
-- Open i2c-0 controller
local i2c = I2C("/dev/i2c-0")

-- Read byte at address 0x100 of EEPROM at 0x50
-- local msgs = { {0xac,0x33,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,flags = I2C.I2C_M_RD} }
 local msgs = { {0x01, 0x00}, {0x00, flags = I2C.I2C_M_RD} }
i2c:transfer(0x38, msgs)
print(string.format("0x100: 0x%02x", msgs[2][1]))
i2c:close()

when run ,it returns

$ lua ./api_iic.lua
lua: Error: I2C transfer: Invalid argument [errno 22]

my version is

$ lua -v
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio

it will be great thansk if you would help to provide more guide to location the problem thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant