How many GPIOs does Raspberry Pi A+ really have? - raspberry-pi

Could someone clarify for me why official documentation of RPI A+ says that it has 40 GPIOs while other sources, such as forums, online courses, and others say that it has 54 GPIOs? What is each one talking about? Is there a difference in types of GPIOs that each source is referring to?
RPI Tutorial by University of Cambridge
https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html :
"There are 54 GPIO pins, so we need 6 sets of 4 bytes, which is 24 bytes in total."
Adafruit Website RPI specs
https://www.adafruit.com/product/2266 : "It's still compatible with all Pi operating systems and software, and has the exact same 40 pin GPIO connector and camera/display sockets"

BCM2835/BCM2835 micro-processor have 54 general-purpose I/O (GPIO) lines in total. This what RPI Tutorial by University of Cambridge is claiming but out of these 54 GPIO lines only 28 general-purpose I/O (GPIO) come on the external J8 header which can easily be interfaced with outside world. 12 pin are used as power pins +3.3V (2), +5V (2) and GND (8).

Related

Profibus synchronisation using Linux (Raspberry Pi)

I am planning to develop a simple Profibus master (FDL level) in Linux, more specifically on a Raspberry Pi. I have an RS485 transceiver based on a MAX 481. The master must work on a bus where there are multiple masters.
According to the Profibus specification, you must count the number of '1' bits on the bus to determine when it is time to rotate the access token. Specifically after 11 '1' bits the next frame starts. 11 bits is also exactly one frame.
In Linux, how can I detect these 11 '1' bits? They won't be registered by the driver as there is no start bit. So I need a stream of bits, instead of decoded bytes.
What would be the best approach?
Unfortunately, making use of microcontroller/microprocessor UART is a BAD choice.
You can generate 11 bits setting START_BIT, STOP_BIT, and PARTITY_BIT (even) in your microcontroller UART peripheral. Maybe you will be lucky to receive whole bytes from a datagram without losses.
However, PROFIBUS DP datagram is up to 244 bytes and PROFIBUS DP requires NO IDLE bits between bytes during datagram transmission. You need a UART hardware or UART microcontroller peripheral with a FIFO or register that supports up to 244 bytes - Which is very uncommon, once this requirement is very specific from PROFIBUS.
Another aspect is related to the compatibility of baud rates. Usually, the whole range of PROFIBUS PD baud rates is not fully available on common microcontrollers UART.
My suggestions:
Implement this UART part on FPGA and interface with Raspberry Pi using e.g. SPI. You can decide on the extension of PROFIBUS stack portion you can 'outsource' to FPGA and the part you can keep on RPi.
Use an ASIC (maybe ASPC2, but outdated) and add another compatible processor to implement a deterministic portion of the stack. Later you can interface this processor with your RPi.
Implement using an industrial communication dedicated processor (Like TI Sitara am335x).

raspberry pi gpio or rs232 relay board for simultaneous output bit-map?

I really wanted at first an rs232 8-channel relay board that I could command devices to turn on/off with a command string.
All of the ones I found online have the same deficiency in functionality for me: you can't set a subset of relays at the exact time. I can set relay 1 on, and then relay 7 on afterwards, I can set all 8 relays at once, but there is no command structure to pick out the exact leds I would like to turn on/off.
In the past I have dealt with hardware that had a bit-map of the IO pins, and a bit-map of the states and would apply all 8 settings at once. here are some examples:
to set pins 1 and 7 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0100 0001b
to set pins 1,2,3,6 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0010 0111b
I couldn't find any such device to do this so I thought I could make one with a raspberry pi using a simple 8-channel relay board, something like this:
https://www.amazon.com/SainSmart-101-70-102-8-Channel-Relay-Module/dp/B0057OC5WK
but on a Raspberry Pi, I'm running into the same issue: I don't see a way to set the gpio pins as a block command, only individually setting them in a for loop. I looked all morning and can see things like gpioctl, and mmio, but I can't put it all together to a simple proof of concept program on a testboard, any help would be appreciated.
I would really like a solution in C or scripting,
Thanks,
jleslie

[google-aiy]: Two vision bonnets on RPi

This is related to project that I'd like build using Google AIY VIsion Kit + Raspberry Pi.
I'd like to attach two vision bonnets to RPi zero W. I realized that Pi interacts with Vision Bonnet using SPI interface. From the schematics of RPi GPIO header, there seems to be two SPI interfaces as well. So, I'm wondering if I can connect two vision bonnets to the Pi. Would that be possible?
Furthermore, I've got two ideas in this regard:
(1) I think all the 40 pins won't be used by a single Vision Bonnet. So, if I know what pins are actually used, I can use that information to consider adding another Vision Bonnet. However, I'm not sure how to get this information though. Can you help me with this information?
(2) If I can't get the detail in (1), I'm thinking to extend the GPIO header on Pi by adding one more header on the VisionBonnet. Then, I'll attach the second bonnet to the newly added header. Does this make sense?
Thanks,
Venky
I posted the question in Google AIY Vision kit issue and the Google developers said that it's not possible.
https://github.com/google/aiyprojects-raspbian/issues/348
Based on the modules loaded (run lsmod), and the python code. I believe it uses more than one SPI. Given this, the answer is that very likely it won't work.
1/ I was not able to find a schema of the bonnet.
2/ Adding headers and connecting the second bonnet won't work as SPI supports communication of two peers only. SPI of the second bonnet will have to be connected to SPI2.
More information, that I found later:
The vision bonnet uses the following GPIO:
SPI interface: GPIO10, GPIO09, GPIO11, GPIO08
Handshaking: GPIO06, GPIO13
An SAMD09 MCU is hung off the I2C bus and uses address 0x51, 0x61 (bootloader only)
LED driver uses address 0x30
Not quite what you are after but I managed to get the Movidius NCS to run on the Pi. It has the same accelerator as the VPU bonnet (Intel® Movidius™ Myriad™ 2 vision processing unit (VPU)). They cost more but you can put as more than one NCS on a Pi via the USB interface. I assume you want to run two models simultaneously rather than scale one model.
The 40-pin pinout as described on google/aiyprojects-raspbian and Vision Bonnet :
3.3V --> 1 2 <-- 5V
I2C_SDA --> 3 4 <-- 5V
I2C_SCL --> 5 6 <-- GND
7 8
GND --> 9 10
11 12
13 14 <-- GND
(GPIO_22) BUZZER_GPIO-->15 16 <-- BUTTON_GPIO (GPIO_23)
3.3V --> 17 18
SPI_MOSI --> 19 20 <-- GND
SPI_MISO --> 21 22
SPI_SCLK --> 23 24 <-- SPI_CE_MRD
GND --> 25 26
ID_SDA --> 27 28 <-- ID_SCL
29 30 <-- GND
PI_TO_MRD_IRQ --> 31 32
MRD_TO_PI_IRQ --> 33 34 <-- GND
35 36
MRD_UNUSED --> 37 38
GND --> 39 40

Raspberry Pi Zero I2C pull up + GY-521

I'm trying to talk via I2C to the gyro sensor MPU6050 which sits on a GY 521 board. But i can't get the device being detect.
I tested another i2c device (EEPROM) and got the device address detected. So i guess it has to be a hardware problem.
As far as i could find out:
RPi has a 1.8k pullup resistor on SDA and SLC already on board
my GY 521 also has also a pullup resistor (2.2k) on each line on board
Could the resistors be the problem? A good resistor value in sum would be around 5k on each line?
(The wiring should be ok, there are a lot of instructions around the net and i've checked it multiple times. I use 5v on the GY521 since it has a voltage converter)
Any help appreciated!
The problem was bad soldering.
For the record:
Using the RPi pullups in combination with the breakout board pullups works for me.

Raspberry B+ Power Supply calculation

I'm new to Raspberry Pi and I don't understand about electricity. I bought a Raspberry B+ today and a 5V 3A power supply, but I'm afraid to connect it because in several places I read about using 5V 2A power supplies. I believe that only higher voltages can damage the Pi but, since I don't know about Amp, I don't know if this is true for 3A too.
My ideia is create a mini-personal server in my home, running Pidora. For data, I have a 1 Tb external USB drive with no external power supply (Seagate model SRD00F1).
My questions are:
can I use the 5V 3A power supply on Raspberry Pi B+ without damage it?
this power supply is compatible with my external USB drive to keep it on safely?
Thank you!
The Raspberry Pi FAQ says that the B+ uses between 0.7 and 1.0 amps, and suggest a 1.2 amp power supply as a minimum.
Using a power supply with a higher amperage rating will not harm your Raspberry Pi. Devices only draw as much current (amperage) as they need. Any additional capacity is unused.
This is where your question about the external hard drive comes in. If you see in the FAQ, they suggest that you might want a larger power supply if you use all of the USB ports. Every USB device you plug in is going to draw more current. To figure out how much you need, you just add up the requirements of all of the devices like so:
Raspberry Pi = 0.7-1.0A
Mouse/Keyboard = 0.5A
Hard Drive = 1.0A
========================
TOTAL = 2.5A
(These numbers are all fake... be sure to check the requirements for your actual devices.)
So if your devices total 2.5A then a 3A supply will handle all of these plus some room for expansion. If all of your devices total 3.5A, maybe you need to consider a bigger one.