Elecrow-RD / CrowPi2

62 stars 16 forks source link

Connecting a Pi HAT #36

Open mrsfixit opened 3 years ago

mrsfixit commented 3 years ago

I'd like to connect a Pi HAT (namely a TV HAT, which is apparently compatible with a Pi 4) to the CrowPi2.

When I connect my TV HAT to a Pi Zero W (running Raspberry Pi OS Lite) I see the following kernel messages in dmesg & /var/log/messages:

[   24.597507] dvbdev: DVB: registering new adapter (CXD2880)
[   24.776606] cxd2880: cxd2880_attach: CXD2880 driver version: Ver 1.4.1 - 1.0.5
[   24.777204] cxd2880 spi0.0: DVB: registering adapter 0 frontend 0 (Sony CXD2880)...
[   24.805460] cxd2880_spi: cxd2880_spi_probe: Sony CXD2880 has successfully attached.

However, although the LED lights up on the HAT when I (?correctly?) connect it to the CrowPi2 ...

Screen Shot 2021-02-21 at 11 08 18 AM

... there's no sign of those kernel messages.

And I'm assuming I need to flick the "switch" from CONNECT SENSOR to DISCONNECT SENSOR:

And I installed tvheadend (which has dvb dependencies) (ie. like I did on the Pi Zero W), but is there something else I need to be doing to detect the HAT?

Do I perhaps need to add or remove something from the CrowPi2's /boot/config.txt?

(Edit: I even tried copying over the /boot/config.txt from the Pi Zero W to the CrowPi2 and booting up with that but I still couldn't see any sign of those kernel messages.)

(FYI I've also tried re-connecting the HAT back to the Pi Zero W - and it still works - so I don't think the issue is with the HAT itself.)

mrsfixit commented 3 years ago

Ok, some progress...

I tried removing the Pi 4 from the CrowPi2 and plugging in my TV HAT directly:

Screen Shot 2021-02-21 at 12 10 41 PM

And that worked!

(ie. when I also removed the gpio=0=op,dl line from /boot/config.txt) Nb. I had tried removing that config line previously but it didn't work when the HAT was connected via the CrowPi2.

So is there perhaps something faulty with the connection between the CrowPi2 and my HAT?

Or, is it possible that the DISCONNECT SENSOR switch doesn't work as I'm expecting?

Nb. I needed to go get these to connect the HAT to the CrowPi2.

Although wouldn't it have made more sense for you to just expose the 40 pin dual header rows on the CrowPi2 as pins instead of a socket? (ie. the same connection that a HAT uses when it connects directly to the Pi 4.)

mrsfixit commented 3 years ago

I thought maybe the pins on the headers I was using to connect the HAT to the CrowPi2 were too short on one side.

However after searching online & in electronics stores I was unable to find headers that had length on both sides. (As I'm assuming the headers I had were designed to have the short side soldered onto boards, so only needed to have length on one side).

So I looked up the pinout of the tv hat. Then as a hack to get pins that were long enough, I ripped out the metal pins from the header with some pliers and inserted them directly in to the corresponding sockets on the CrowPi2 like so:

Screen Shot 2021-02-21 at 5 50 37 PM

Then I attached the TV HAT to the CrowPi2 like so:

Screen Shot 2021-02-21 at 5 51 53 PM

(Nb. using the same /boot/config.txt I did when I saw the TV HAT being detected correctly by the kernel when attached directly to the Pi 4)

However - once again - the HAT is not being detected.

Any ideas on what I could try next?

kensuke commented 3 years ago

long header on both sides is here in Japan store, but didn't shipped overseas. https://akizukidenshi.com/catalog/g/gC-12180/

rabagliati commented 3 years ago

May I leave another request for the schematic diagrams around the pins, the sensor switch, I2C and power be made available to help us with our projects.

mrsfixit commented 3 years ago

Thanks @kensuke, although I would have thought my pin hack should have worked. And besides the LED on my HAT always lit up - so surely the pins are long enough. I'm just suspicious that something else is happening around the pins that's messing with my HAT.

Has anyone else ever got a HAT of any kind working plugged into the CrowPi2? If so which ones? And do any of them use I2C like my HAT does?

kensuke commented 3 years ago

IMG_2129- confirmed some devices

CrowPi2 - long header pin - pHAT Stack with ribbon cable
 - Crowtail Base Shield
   - (I2C) Color Sensor - working
   - (Digital) LED(red) - working
   - (Analog) Pulse Sensor(green) - maybe working (I didn't confirm this time)
 - Scroll pHAT HD - working clock.py shows 09:35
 - XmasTree - working
 - Piano HAT - don't working. connect directry to CrowPi2 without pHAT Stack, also don't working... In my ambiguous memory, Piano HAT works with CrowPi2, so this is a software environment problem.
mrsfixit commented 3 years ago

Oh wow - thanks once more @kensuke, your ✨amazing✨ collection has given me some hope.

Ahhh I see long & short header pins in your picture.

So are you able to confirm that when you put the long pins into your ribbon cable & the short side into the CrowPi2 that the connection doesn't work? (And that switching that out for the long pins on both sides works?) (That would be really useful to know.)

Yer my local electronics store didn't have the double sided long header pins, but I'll try ordering some online and try again.

BTW (if anyone who stumbles across this thread is interested), I found the pinouts for a couple of your HATs here:

mrsfixit commented 3 years ago

(see also my attempt to document the pinout for the TV HAT - https://github.com/Gadgetoid/Pinout.xyz/pull/406)

mrsfixit commented 3 years ago

@kensuke - I was just wondering if you could please confirm that the difference between this working & not working is due to having the long pins on both sides?

mrsfixit commented 3 years ago

FYI, to anyone interested, I got some headers - long pins on both sides - but still the TV HAT was not detected when plugged in via the CrowPi2.