Raspberry CM3 + additional sd card - raspberry-pi

I want to use Raspberry Compute Module 3 (CM3) for an industrial project.
The problem is that 4GB of emmc (connected to SD0 broadcom private bus) is not enough.
I want to connect an additional SD card (8GB) throught the second SD interface SD1 (GPIO from 22 to 27 in ALT3).
The problem is that with this connection and with the default Raspbian Lite jessy (kernel 4.4) the connected sdcard is not recognized.
I tried to set the gpio alternate (ALT3) function with cli raspi-gpio but no results.
What is the problem?

We are using the CM3L version (no on-board flash), and my references are to the schematic titled "Raspberry Pi Compute Module 3 (reduced)", dated 10-13-2016.
The CM3L cannot access an external SD card because the control lines are not brought out to the card-edge pins. We modified our CM3 samples, turning them into CM3L units with the following steps to remove the on-board flash and to bring the control lines to the card-edge pins (notes taken from my marked-up schematic):
To turn CM3 into CM3L:
Move R24 to R25 position
Short R12, R16, R17, R18, R19
Remove U7 (BGA Flash)
Not documented, but seems to be necessary: R9 should be zero Ohms,
and R8 is listed as a 2.2k Pull-up, but seems to be zero Ohms. Move R8 to
R9 position (or maybe just short across R9 pads.

Posssible using other gpio but not sd0, eg. Dev board won't do without modification.
See this thread. The other answer isn't ideal IMHO as you can't use both and are permanently modifying your compute.
You can have the 2nd SDIO peripheral at GPIO 22-27 or 34-39.
https://www.raspberrypi.org/forums/viewtopic.php?t=172406

Related

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

GNU Assembler and Exception Vector Table

I have been done the Baking Pi tutorial, and I have studied about SVC system call, in the Baking Pi tutorial, it set the base of my program is 0x8000 but the vector table base is 0, how do I access 0x0 by GNU assembler and use which kernel.ld I use now?
Depending on the Pi you can start at 0x8000 or 0x80000 by default. There are now different filenames to guide the bootloader as to what mode you want the processor kernel.img, kernel7.img kernel32.img or some various combinations you can easily look this up.
The baking Pi first off had issues as written but asked and answered many times in the Raspberry Pi website baremetal forums (a very good resource, best I have seen in a long time if not ever). You will need to be using an old old pi or a Pi Zero to get the tutorial to work unless it has been updated.
This is bare metal you own the whole address space if you want to put something at zero you simply do that.
Another approach is you can create a config.txt file and in that you can tell the bootloader in the GPU to load your image to 0x00000000 in the arms address space. Depending on the arm core you are using you can also use a VTOR register if present to change where the vector table is (so set it at 0x80000 instead of 0x0000. I don't think the arm11 in the Pi Zero or old old pis allows for that though. 32 bit mode on the newer ones does, but they are multi-core and that will unravel any learning exercises. you have to "sort the cores" as I like to say on boot, isolating one to continue and putting the others in an infinite loop so they don't interfere. The boot code that the gpu lays down for you on those Pi's does this for you so that only one hits 0x8000 or 0x80000, so the config.txt approach is something folks contemplate, but I would recommend against it for a while.
There are a number of tutorials linked in the raspberrypi baremetal forum on their website that should take you well beyond the baking Pi one(s). and/or help you through those as folks struggled with them for some time.
A linker script like this
MEMORY
{
ram : ORIGIN = 0x8000, LENGTH = 0x10000
}
SECTIONS
{
.text : { *(.text*) } > ram
.rodata : { *(.rodata*) } > ram
.bss : { *(.bss*) } > ram
.data : { *(.data*) } > ram
}
with a bootstrap like this
.globl _start
_start:
mov sp,#0x8000
bl main
hang: b hang
should get you booted.
For the linker script you may need 0x80000 instead of 0x8000, and if you have at least one .data item, like a global variable:
unsigned int x = 5;
Then the bootstrap doesn't have to zero .bss (if your programming style is such that you rely on that). objcopy will pad the -O binary file with zeros between .rodata and .data if there is .data there taking care of zeroing bss.
You can let the tools do the work for you as far as an exception table goes:
.globl _start
_start:
ldr pc,reset_handler
ldr pc,undefined_handler
ldr pc,swi_handler
ldr pc,prefetch_handler
ldr pc,data_handler
ldr pc,unused_handler
ldr pc,irq_handler
ldr pc,fiq_handler
reset_handler: .word reset
undefined_handler: .word hang
swi_handler: .word hang
prefetch_handler: .word hang
data_handler: .word hang
unused_handler: .word hang
irq_handler: .word irq
fiq_handler: .word hang
reset:
mov r0,#0x8000
mov r1,#0x0000
ldmia r0!,{r2,r3,r4,r5,r6,r7,r8,r9}
stmia r1!,{r2,r3,r4,r5,r6,r7,r8,r9}
ldmia r0!,{r2,r3,r4,r5,r6,r7,r8,r9}
stmia r1!,{r2,r3,r4,r5,r6,r7,r8,r9}
Now if this is not a Pi Zero then the vector table works differently you need to read the arm docs anyway before going off into stuff like this but read up on the core and mode as well as the architecture docs for whichever you are using. The newer Pis have an armv7 mode and an armv8 mode (aarch32 and aarch64) and each has its own challenges, but they have all been covered in the forum.

Raspberry Pi - More GPIO pins or/and more leds

Like the title said, I need more GPIO pins or just a way to control a lot leds
So I need to control more than 40 leds, or even more, anyway more than raspberry pi has GPIO pins. So I know that there is extension board for Raspberry Pi that extends the GPIO, that's one way to solve it. If anyone ever had one can recommend it to me.
Another idea that I got was to use led matrix but instead use the same idea, I mean for example led row 1 and column 4 or so, but the leds won't be in Grid, instead, they will be separated with wires. But the problem, if we want to do like that:
X O X
O X O
X O X
where X is on and O is off, it's not possible. All leds will be lit up, not like in the pattern. If anyone has the solution to one of the ideas then please share it with me, thank you for your time!
You want to control lots of LEDs using as few GPIO pins as possible.
Solution
The way to do this is to use a technique called Charlieplexing. The name comes from the inventor, Charlie Allen of the company Maxim, and the technique takes advantage of the feature of GPIO pins that allows them to be changed from outputs to inputs while a program is running. When a pin is changed to be an input, not enough current will flow through it to light an LED or influence other pins connected to the LED that are set as outputs.
use breadboard
for more information go to this link
http://razzpisampler.oreilly.com/ch04.html

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.