Minimalist GPIO toggle experiment.

I'm looking at the *.pdf from
formatting link

and wondering what the 2 other matching sets are,
other than the 26pin-header?
BCM-GPIO would probably be the ChipPins?
Them what's the "Wiring Pi Pin" set?
None of the 26 header-pin voltages [0, 3.3, 5]
disagree with the *.pdf information.
Without access to the basic documentaion and just copying
this code: ------------
# Set up GPIO 4 and set to output
echo "4" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio4/direction
# Write output
echo "1" > /sys/class/gpio/gpio4/value
and adding:
sleep 2
echo "0" > /sys/class/gpio/gpio4/value
sleep 2
to the script, I'm trying to slowly pulse header pin 16.
Actually I've got multiple pulses coded, because I don't
know if it could be interrupted, if coded to .
This is not a good/minimalist test.
Can't all 8bits of the output register be switched?
Like: .
That would eliminate the extra complication of
mapping the various sets.
Always start with the simplest most-general version.
Eg. check that the power LED illuminates.
== TIA.
Reply to
Loading thread data ...
What do you mean by "2 other matching sets" ? Do you mean other connectors - the camera and display connectors? (The ones with the long caps on-top?)
It's a long story.
Way back, even before the Pi was in production there was a lot of articles, some conflicting on the Pin layout. An early description simply called the main 8 usable pins GPIO 0 through GPIO 7.
So that's what I adopted for my wiringPi. (And numbered the other pins linearly after that)
There then followed much discussion, threats, and personal abuse (directed to me) because "that's not the way to do it". Apparently the way to do it is to not abstract the chip pins (the internal BCM_GPIO pin numbers) but to use them directly....
So you have in wiringPi land: 0 through 7, or in the BCM_GPIO world, 17, 18, 21, 22, 23, 24, 25, 4, or if you have a Rev 2 Pi, then s/21/27/. (it doesn't change in wiringPi).
So the choice is yours - use the BCM pin numbers, or the wiringPi numbers. (Or the physical P1 pin numbers which is prefered in some instances - e.g. when programming in Scratch from what I can tell)
FWIW: My thoughts were to de-couple the hardware pins from the user in the same way that Arduino wiring does this - so on the arduino, you just say "pin 13", rather than port B, bit 5, and so on.
I hope they don't!
If you have wiringPi installed then:
#!/bin/bash gpio mode 7 out while true; do gpio write 7 1 ; sleep 0.5 gpio write 7 0 ; sleep 0.5 done
It's better than nothing... And I teach using the gpio command (part of wiringPi) to test/debug simple interfacing circuits.
Not from the shell. You can do it in software - e.g.
gpio wb 0xAA
The GPIO register in the Pi's SoC is actually 54 bits wide (2 x 32 bit register). The ones we are intereste in are (fortunately) in the first 32-bit register (or I shoudl say registers as there are 2 for writes, one to write 0, one to write 1) The bits we want are at various positions inside that register (17, 18, etc. as above), so to write all 8 of the external pins at once, requires some bit-fiddling to make a 32-bit word, then write that word (actually 2 writes, one to the clear register, one to the set register - that's the way it works)
And don't forget it's 3.3v output/inputs and try to keep the current draw from each pin to under 8mA if possible, and under 50mA for the entire chip.
However, it's open to abuse:
formatting link

Gordon (author of wiringPi - see also
formatting link
Reply to
Gordon Henderson
--File snipped text for reference--
I can't get ANYTHING install from inet, without ETH, or `eject` [to switch the 3G dongle]
I wouldn't believe you, if I hadn't looked at the BCM2835-pdf.
It's a monster! And very depressing.
Have you used/confirmed the syntax:-- echo "4" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio4/direction echo "1" > /sys/class/gpio/gpio4/value ;sleep 1 echo "0" > /sys/class/gpio/gpio4/value ;sleep 1
Although, it seems that I've got the GPIO0-7 to header-pin mapping right, I'd still write a script to cycle through all 8-bits, which makes it 'more minimalist', in the sense that you don't need to have the correct header-mapping.
The principle of successive refinement allows economic use of effort, by starting from the crudest initial confirmation; instead of making a rocket to the moon, which must totally succeed else be a total loss.
Thanks for the help.
Reply to
Yes, it's not at all like a typical microcontroller 8-bit port, which is controlled by a single byte.
But the Pi is fast enough that it should be satisfactory to write a subroutine that does all the dirty work to make it *look* like a simple 8-bit port.
-michael - NadaNet 3.1 and AppleCrate II:
Reply to
Michael J. Mahon
No! The key-word in my chosen 'Subject:' : "Minimalist" recognises that I've got a limited remaining-life-time. So I was hoping for feed-back re. syntax. So now I'll try google. But I've started to hate bigG too, since they've become abusive monopolists: blocking access unless you use graphic-browsers, allowing them to push their ads in-yo- face.
=== PS.
formatting link
which I had, is fantastic; only needs time/effort. Q: How can people be unemployed?! A: Because they've been made to expect to operate at the level of: apt-get install potatoe banana shoe ......
Reply to
OK, but what's your issue? Writing a half page of code that implements a simple 8-bit port sounds pretty simple to me...
That could be done and working in the time you've spent searching. ;-)
-michael - NadaNet 3.1 and AppleCrate II:
Reply to
Michael J. Mahon

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.