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

hyperpixel and i2c devices on pi4 #191

Open
Dtanguy opened this issue Nov 16, 2022 · 7 comments
Open

hyperpixel and i2c devices on pi4 #191

Dtanguy opened this issue Nov 16, 2022 · 7 comments

Comments

@Dtanguy
Copy link

Dtanguy commented Nov 16, 2022

Hello, i am trying to use i2c devices on a pi4 with a hyperpixel4 rectangular screen.

I have this config in /boot/config.txt :
dtoverlay=vc4-kms-dpi-hyperpixel4,rotate=180

When i enable i2c in /boot/config.txt the screen stop working.

I have also try creating another i2c port by adding :
dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=17,i2c_gpio_scl=27

How can i use i2c device and the hyperpixel ? Thanks.

@cpietsch
Copy link

I have the same issue after enabling raspicam.

@neozenith
Copy link
Contributor

neozenith commented Nov 9, 2023

Yeah similar fight getting HyperPixel4 Touch Rectangular working with a PiJuice Hat. Probably a bit too ambitious but I think there are sufficient pins if I can just remap where they are talking.

These docs from Raspberry Pi about DPI is helpful:
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#parallel-display-interface

As well as this whitepaper has some details about different colour modes in the protocol that reduce the number of pins required. Just depends if the Hyperpixel4 supports those colour modes.
https://pip.raspberrypi.com/categories/685-whitepapers-app-notes/documents/RP-003471-WP/Using-a-DPI-display.pdf

Screenshot 2023-11-10 at 6 26 37 am

Here are some key extracts from the whitepaper where they mention specifically the Hyperpixel4

Screenshot 2023-11-10 at 6 28 44 am Screenshot 2023-11-10 at 6 31 01 am Screenshot 2023-11-10 at 6 32 03 am

So, whilst not helpful with the i2c part, this config maps the old config to the new format which might expose some new options to experiment with I hope?

# OLD
# dtoverlay=hyperpixel4
# dpi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6
# dpi_timings=<hactive> <h_sync_polarity> <hfp> <hsync> <hbp> <vactive> <v_sync_polarity> <vfp> <vsync> <vbp> <n/a> <n/a> <n/a> <n/a> <n/a> <clockfrequency> <n/a>

# NEW
dtoverlay=vc4-kms-dpi-generic
dtparam=hactive=480,hfp=10,hsync=16,hbp=59
dtparam=vactive=800,vfp=15,vsync=113,vbp=15
dtparam=clock-frequency=32000000

# OLD
# dpi_output_format=0x7f216

# NEW
dtparam=hsync-invert,vsync-invert,pixclk-invert
dtparam=rgb666-padhi

@neozenith
Copy link
Contributor

neozenith commented Nov 9, 2023

Pinouts collide

Actually upon reading this pinout page:
https://pinout.xyz/pinout/pijuice
Screenshot 2023-11-10 at 6 56 27 am

And:
https://pinout.xyz/pinout/hyperpixel4
Screenshot 2023-11-10 at 6 57 04 am

It looks like the direct 40 pin stacking collides on GPIO pins 3,5. 😭

Exposed I2C Passthrough

Although the Hyperpixel4 exposes 5 pinouts on the underside of the board:
IMG_1810

That pass through might be your best bet to getting extra I2C devices talking.

But there isn't exactly instructions on how to get that working.

The PiJuice also has it's own I2C bus breakout:
Screenshot 2023-11-10 at 7 14 25 am

@neozenith
Copy link
Contributor

https://github.com/PiSupply/PiJuice/blob/master/README.md#technical-specs-summary

The EEPROM can be disabled and its I2C address changed for increased compatibility with other boards

I might be in luck here to set up the PiJuice Hat to get out of the way of the Hyperpixel4.

@AlexanderProd
Copy link

I'm just wondering why the screen wont work as soon as I turn on I2C using raspi-config even when no other device is connected.

@Gadgetoid
Copy link
Member

I'm just wondering why the screen wont work as soon as I turn on I2C using raspi-config even when no other device is connected.

radio-config enables an i2c bus on specific pins- so you’re telling your Pi to use the display vsync and hsync pins as i2c. They can’t do both.

i2c - on the touch pins- is already provided by the HyperPixel driver. It should be visible as “/dev/i2cN” but since most software assumes 1 you might need to symlink that to avoid modifying the software itself.

You might also IIRC need to “modprobe i2c-dev” for the device node to show up.

@neozenith
Copy link
Contributor

neozenith commented Nov 14, 2023

Bookworm Config Location Changed

So it took me longer than it should have to realise that using Raspbian Bookworm, they moved /boot/config.txt to /boot/firmware/config.txt as to why my changes stopped working. 🤦

This is my config for the Hyperpixel4 touch on Rasbian Bookworm and it "just works".

# https://github.com/pimoroni/hyperpixel4/issues/177
dtoverlay=vc4-kms-dpi-hyperpixel4

Simple i2c testing with BME680

Regarding this comment:

i2c - on the touch pins- is already provided by the HyperPixel driver

@Gadgetoid did you mean this new driver provided by Raspbian handles this too?
Or only the driver in this repo?

Any ideas where this new driver is being maintained?

I scaled back my testing from the PiJuice to just using a BME680 environmental sensor and a JST-PH to male DuPont connector on the underside Hyperpixel4 i2c connector.

This device in theory should have an address of 0x77.

I run:

$ ls /dev/i2c*

/dev/i2c-20
/dev/i2c-21
/dev/i2c-22

/dev/i2c-22 is the new one that appears when I have the Hyperpixel4 attached and the other 2 already existed when it is not attached.

I ran:

modprobe i2c-dev
i2c-detect -y 22

I didn't capture the output but I couldn't see anything that would indicate a device with address 0x77 was attached. I think I did see a list of the touchscreen addresses though.

(I'll take some time on the weekend to try again and update this issue with exact output.)

UPDATE: I tried what few I2C devices I had on the port but also on the bare RPi4 and they didn't work.... I think they may have had the magic smoke at some point. I'm ordering some new sensors and will update after that.

I think that /dev/i2c-22 that appears is like a software i2c bus right? So any adafruit drivers that might be hardcoded to look for bus 1, like you said, would need /dev/i2c-22 symlinked to /dev/i2c-1.

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

5 participants