Using Pin 7 for Blinky with the GrovePi in place


#1

Sorry to ask, but this is making me nuts.

Given the simple C program using the RPi3 with the GrovePi installed:

#include <bcm2835.h>
#include <stdio.h>

#define PIN RPI_BPLUS_GPIO_J8_7

int main(int argc, char **argv) {

if (!bcm2835_init())
return 1;

bcm2835_gpio_fsel(PIN,BCM2835_GPIO_FSEL_OUTP);

int i = 0;

for(i = 0; i < 10; i++) {

bcm2835_gpio_set(PIN);
bcm2835_delay(500);
bcm2835_gpio_clr(PIN);
bcm2835_delay(500);

}

bcm2835_close();

return 0;
}

The LED will blink from 0 to a few times and then stop blinking while the program continues to run to the end.

If I use RPI_BPLUS_GPIO_J8_12, I get the expected result of 10 blinks. I wrote the program in Python and it suffers the same problem. I used both programs on an RPi2 and either Pin 7 or Pin 12 work just fine.

I even ordered another RPi3 to be sure it wasn’t a board problem and got the exact same test results with the new board.

I then tried it without the GrovePi and it still failed the test.

I should also note that I’ve tried every construct of setting and clearing the pins using bcm2835_write.

Can anyone tell me what I’m missing or reproduce this with an RPi3?

Best Regards,

Glenn


#2

I think this question would be better suited on the Raspberry Pi forums. Just because this sounds like a complex issue with the RPi itself. Have you tried updating the firmware on the pi?


#3

Hi @glenn.miller,

It looks like you are trying to use the GPIO pins, but with GrovePi you can use the Grove ports and you can program them in C. You can learn more about the GrovePi ports here. You can use this example in C to make a Blinky program. Check the instructions here to run the program.

Please let us know if this helps,
-Shoban


#4

Hello, Shoban.

The example runs perfectly using port D4. Thank you.

It still leaves me with the same problem of addressing the native RPi3 pin 7. I’ve asked in the Raspberry Pi forums with no responses. I appreciate you taking the time to help.

Regards,

Glenn


#5

I have updated to the latest firmware.

I also posted this question on the Raspberry pi forums more than two weeks back without a response. I’ll continue to try to find an answer. Thanks for your time.

Regards,

Glenn


#6

are you on a standard Raspbian or Raspbian for Robots?


#7

It is Raspbian Jessie.

Regards,

Glenn


#8

Sorry, I had an inkling of an idea, but nope, it didn’t pan out.
Just to be sure (as I have yet to do any C coding on a Pi - shame really as C is my native language. I just don’t use it anymore), we’re talking about this specific pin:
https://pinout.xyz/pinout/pin26_gpio7

It’s also marked as a SPI pin. Is SPI active on your card?


#9

No. Physical pin 7. Fourth one down on the left.

Thanks.