User avatar
solar3000
Posts: 1087
Joined: Sat May 18, 2013 12:14 am

Perl Device::BCM2835 Pins fail: 3, 5, 13

Sun Jun 16, 2013 1:34 am

Installed Device::BCM2835 from CPAN in perl on raspbian.

I've tested all the GPIO pins.

Here are the results:
These pins work as expected: 7, 8, 10, 11, 12, 15, 16, 18, 19, 21, 22, 23, 24, 26

Pins:
3 gives me negative voltage
5 stays on
13 gives me .25 v

What's going on?
Antikythera

User avatar
jojopi
Posts: 3862
Joined: Tue Oct 11, 2011 8:38 pm

Re: Perl Device::BCM2835 Pins fail: 3, 5, 13

Sun Jun 16, 2013 3:42 am

Pins 3,5,13 changed from being GPIO 0,1,21 on Rev1 boards to GPIO 2,3,27 on Rev2. See: http://www.raspberrypi.org/archives/1929

GPIO libraries handle this in different ways. Device::BCM2835 uses the Broadcom numbers internally but provides constants like RPI_GPIO_P1_13 if you want to refer to physical connector pin numbers. It seems to be your responsibility to check the board revision and use RPI_V2_GPIO_P1_13 if appropriate.

You can check the board revision in /proc/cpuinfo:

Code: Select all

open my $cpuinfo, '<', '/proc/cpuinfo';
my %cpuinfo = map {/(.*?)\s*:\s*(.*)/ ? ($1 => $2) : ()} <$cpuinfo>;
close $cpuinfo;
if ($cpuinfo{Hardware} ne 'BCM2708') {
  print "Not a Raspberry Pi?\n";
} elsif ($cpuinfo{Revision} =~ /000[23]$/) {
  print "Raspberry Pi Revision 1\n";
} else {
  print "Raspberry Pi Revision 2 or later\n";
}
Full list of codes in this thread: http://www.raspberrypi.org/phpBB3/viewt ... 39#p281039

User avatar
solar3000
Posts: 1087
Joined: Sat May 18, 2013 12:14 am

Re: Perl Device::BCM2835 Pins fail: 3, 5, 13

Sun Jun 16, 2013 11:51 am

So the software must be old.
Antikythera

Return to “Other programming languages”