0

I'm using Raspberry Pi 2 Model B with Rasbian and I'm trying to manipulate the GPIO ports in C by directly accessing registers (http://www.pieter-jan.com/node/15 - reference).

I have already configured pins 5, 6, and 7 as output by setting GPFSEL 5, 6, and 7 with a value 3'b001. Initially, I determined the output voltage on the GPIO pins and verified that their values are 0V. But when I tried to set GPSET register for pin 5 to 1, I checked the voltages of the 3 GPIO pins. The pin 5 had a reading of 3.3V which is the expected behavior, but other pins also changed their value to 3.3V. I checked pin 7 also had a reading of 3.3V when I did not even set the GPSET value of the pin to 1.

Thanks

1

One you set a GPIO as an output it will drive the pad to ground or 3V3 depending on what was last selected for that pad.

  • Thanks for this response. Does this mean that when I set a pin as an output, it is defaulted a value of either 0 or 3.3V? Because based on my testing when I set the 3 pins as an output, I took an initial reading and verified that all pins have 0V reading. I altered the program adding a setting of 1 to GPSET for only pin 5, I took the readings again and both pin 5 and pin 7 now have a reading of 3.3V. Thanks – user47845 Jun 10 '16 at 17:23
  • One they are set as an output they will be driving to either ground or 3V3. They don't change if you set another GPIO. If you set them as outputs, measured them, set a level, and another GPIO level changed that means you have something wrong in your set level software. – joan Jun 10 '16 at 17:28
  • Thanks again, I'll continue troubleshooting and try to determine what caused the change in level on pin 7. – user47845 Jun 10 '16 at 17:37
  • Hi, another quick question, I noticed when I tried to look into the value of GPSET register (32 bit), it already has a value of 0x6770696F, is this ok as I am expecting an initial value of 32'b0. Also I tried setting bit 5 of GPSET register to 1, but it did not change the value to 0x6770697F, should the value be changed upon setting GPSET bit 5 to 1? Thanks – user47845 Jun 10 '16 at 17:49
  • Those registers are write only, they read back as 'gpio' (0x6770696F). – joan Jun 10 '16 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.