pimoroni / hyperpixel4

Driver for the Pimoroni HyperPixel 4.0" Touchscreen Display
https://shop.pimoroni.com/products/hyperpixel-4?variant=12569485443155
329 stars 45 forks source link

i2c symlink in docs is outdated #220

Open SamSkjord opened 1 month ago

SamSkjord commented 1 month ago

Describe the bug

Current bash command to create a symlink for the i2c output header is outdated, sudo ln -s /dev/i2c-22 /dev/i2c-1 works correctly

To Reproduce

https://learn.pimoroni.com/article/getting-started-with-hyperpixel-4#using-the-alternate-i2c-interface-on-hyperpixel-4-0-for-advanced-users

Your HyperPixel 4

Let us know which HyperPixel 4 board you're using. Note: if you're having a problem with the original HyperPixel you should go to: https://github.com/pimoroni/hyperpixel

  1. Rectangular
  2. Non Touch
  3. Jul 2024
  4. Directly via Header

Your Raspberry Pi

Pi4b on Debian GNU/Linux 12 (bookworm)

i2cdetect -y 1

Error: Could not open file /dev/i2c-1' or/dev/i2c/1': No such file or directory

sudo ln -s /dev/i2c-22 /dev/i2c-1

i2cdetect -y 1

00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 51 52 53 -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

thijstriemstra commented 1 month ago

@SamSkjord Using raspberry pi 3b+ and bookworm (6.6.31+rpt-rpi-v8), I don't see an i2c-22 to symlink? Also, such a symlink doesn't persist after a reboot.

 $ ls -l /dev/i2c-*
crw-rw---- 1 root i2c 89, 11 Jul 25 17:46 /dev/i2c-11
crw-rw---- 1 root i2c 89,  2 Jul 25 17:46 /dev/i2c-2

Maybe it's 11? I haven't connected an i2c device yet but outputs:

$ i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
$ i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Update: after connecting an DS3231 it shows up (68):

$ sudo i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

but I can't find a way to use /dev/i2c-11with the i2c-rtc ds3231 overlay...

Update 2: run this /usr/bin/setup-ds3231.shscript at boot to read the time from the RTC and set it systemwide:

#!/bin/bash

echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-11/new_device
sleep 1s
# set the system time from the RTC
sudo hwclock -s

Luckily it doesn't mess with the display or touch.

$ sudo i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --