mrmorphic / hwio

Go library for hardware I/O control, in the programming style of Arduino
BSD 3-Clause "New" or "Revised" License
328 stars 40 forks source link

Unable to select suitable driver for this board #49

Open lucavallin opened 7 years ago

lucavallin commented 7 years ago

More details here: http://forum.dexterindustries.com/t/grove-dht-and-golang-in-general/3187 i2cdetect returns the expected result, but I still get the error.

mrmorphic commented 7 years ago

Hi. It's probably the library. When starting up, the library needs to select an appropriate driver for the board. Different boards support different hardware. There is a raspberry pi driver, but it looks in /proc/cpuinfo for the presence of BCM2708 or BCM2709. Chances are you've got a newer raspberry pi that uses a different chip set. Can you post the contents of /proc/cpuinfo from your raspberry pi? And what model of raspberry pi do you have?

lucavallin commented 7 years ago

Raspberry Pi 3

processor   : 0
model name  : ARMv7 Processor rev 4 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd03
CPU revision    : 4

processor   : 1
model name  : ARMv7 Processor rev 4 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd03
CPU revision    : 4

processor   : 2
model name  : ARMv7 Processor rev 4 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd03
CPU revision    : 4

processor   : 3
model name  : ARMv7 Processor rev 4 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd03
CPU revision    : 4

Hardware    : BCM2835
Revision    : a02082
Serial      : 00000000ade634d8
lucavallin commented 7 years ago

I've added

if strings.Contains(s, "BCM2708") || strings.Contains(s, "BCM2709") || strings.Contains(s, "BCM2835")

And it seems to work, I'll test it a bit more to be sure and will provide updates.

mrmorphic commented 7 years ago

Ok sweet. I don't have a board to test it on. The Raspberry Pi driver firstly detects if it applies (the test you've amended), but it also contains a function createPinData() that selects configuration for boards, since the raspberry pis sometimes change their hardware with each revision. The default case in that function is for a rasppi B+. From what I can see online, the 3 model has the same pinouts as the B+, so the B+ config should work. Just be aware that there can be differences.

Do you want to create a pull request for that change, or would you like me to apply that?

M

lucavallin commented 7 years ago

Ok, awesome, thanks. Yep, I can make a PR tonight when I'm back home.

adityaalviori commented 6 years ago

Hi, @mrmorphic I am newbie on BeagleBone Black and Go Lang, but when I ran blink.go, I got "Unable to select a suitable driver for this board" my cpuinfo ''' processor : 0 model name : ARMv7 Processor rev 2 (v7l) BogoMIPS : 995.32 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x3 CPU part : 0xc08 CPU revision : 2

Hardware : Generic AM33XX (Flattened Device Tree) Revision : 0000 Serial : 0000000000000000 ''' thanks for your help