RASPBERRY : Write to an external microSD card in SPI mode - raspberry-pi

I have already posted this question on the raspberry forum but I only got a few answers that didn't solve my problem... I have been waiting for a month so I turn to this forum hoping to be able to find a solution there...
PS : do not hesitate to check my post on RPI forum to see my progress and my research/tests carried out (https://forums.raspberrypi.com/viewtopic.php?t=335338)
So here is my problem :
I have been looking for a while how to write to an external microSD card in SPI mode...
My goal is to write data collected by a sensor an store them on various microSD cards (6) by using CS. But at this point, I'm tring to write data on one card.
I'm using a RPI Zero 2W, a simple microSD card module and an 512GB microSD card (with exFAT filesystem).
I saw that there was a "mmc_spi" driver included in a linux kernel which allows to detect an SD card connected by SPI as if it were a USB key to which we could simply access/read/write (https://ralimtek.com/posts/2016/2016-12-10-raspberry_pi_secondary_sd_card/)
the problem is that this tutorial is not working anymore... In fact, the linux Kernel used in the tuto is an old one compare to the current version and and I had confirmation that the "mmc_spi" driver used to detect the SD card had evolved but the use of this new version is not documented and obviously does not work like the old one...
So my question is : does the mmc_spi driver still allows to detect SD cards and access them and if yes, does it works with the PI zero 2W ?

Related

How to flash without STLINK

My STLINKV2 is not working anymore, not detected by Linux, it failed after the first successful flash. I ordered a new one but it will take 60+ days to arrive. Meanwhile I have heard on Youtube you can program Bluepills directly by connecting cut open USB cable to certain pins and then using a jumper. But I cannot get any precie information on this, is this really possible and how?
You should use the embedded bootloader. You can flash it through several interfaces. Look at AN2606, maybe you can find an already written flasher. Good luck STM32CubeProgrammer handle it.
If you intend to program it through usb, look also at AN3156 all protocols document are referred in chapter 2 of AN2606
THOSE AREN'T CUT OPEN USB CABLES they are USB to serial adapters for arduino's bootloader
They connect them like this:
The problem is that this requires the Arduino STM32 bootloader to be flashed in it.
Another option will be to use STM32CubeProg this program allows you to program your stm over
Serial
SPI
I2C
USB
You'll need to set the BOOT0 and BOOT1 pins to the correct value (HIGH slash LOW) to allow it to go in flash mode during boot.
Here is semi outdated tutorial which tells most of the steps to program a STM using serial. (the Flash Loader Demonstrator is outdated and you should use STM32CubeProg)

Cannot Use Raspberry Pi Camera v1/2 with Gumstix Pi Compute Dev Board

Referencing this item:
https://store.gumstix.com/gumstix-pi-compute-dev-board.html
I cannot use the official Pi camera(s) using either the official Raspberry Pi "Buster" disk image or the Pi disk image provided by Gumstix:
Disk image referenced here--> https://store.gumstix.com/raspberry-pi-cm-fast-flash.html
Note: The Gumstix Pi image would "hang" on the rainbow colored splash screen during boot, using the image above. I am using the "fast flash" board to write the images, and have been able to repeatedly (successfully) install the standard Raspbian OS. FYI I have been using Balena Etcher, and it has worked with my other boards.
Also, I followed the official instructions to add camera support in an attempt to understand what I am doing wrong. vcgencmd initially reported no support or detection in raspbian. I was able to add camera support using the blobs mentioned here (I compliled manually and also used the precompiled variant):
https://www.raspberrypi.org/documentation/hardware/computemodule/cmio-camera.md
Final result:
vcgencmd get_camera : supported=1 detected=0
Lastly, yes the camera is enabled, and I have tested the cam/cable on other systems with no issues. I suspect the pin GPIO settings may be to blame, but based on the information in front of me (for this board) I should not be expecting to manually adjust those params. Thanks for any insight….hopefully this is an I-D-10-T error.
First off I should appologize, the page you referenced about getting the disk image is very out of date. We will work to update it soon.
My guess of why it's not booting is likely a hardware imcompatibilty, are you using a Raspberry Pi CM3+?
Give this image a try
https://gumstix-raspbian.s3.amazonaws.com/2019-12-29/raspberrypi-cm3/rpi-4.19.y/2019-09-26-raspbian-buster-lite.img.xz
That's a recently compiled Buster image that has some extra drivers added in to support Geppetto modules. The default Buster image should also work.
To properly support any of our boards, it's best to download the board support package for that particular design. In your case, you're using the Gumstix Pi Compute Dev Board, which can be found
https://geppetto.gumstix.com/#!/design/1045/
Please go to that page and click on the "AutoBSP" button on the top. That will prompt you to download a zip file that will contain some instructions and files needed to configure the Raspberry Pi.
Please let me know if you have any trouble.
Thanks,
Andrew

Codesys V3 and Raspberry Pi SL - How to read values from addresses

Good evening.
I have a short question regarding the use of CODESYS Development System V3 and the associated CODESYS Control for Raspberry Pi SL. How do I manage to acquire the values of the connected sensors (e.g. si705x, vcnl) or to write certain bits via the I2C bus? Unfortunately, I cannot find any decisive results or useful documentation for use. With the datasheets of the respective sensors I don't get on either.
Greez
A good worked example, but for another i2c sensor, with code for RPi can be found on this page. Read/learn from this one and you can build your own.

MicroSD Card versus USB Flash Drive for Raspberry Pi 2

Articles on this topic from 2012 for earlier RPi hardware extolling the virtues of using an external USB flash drive are now dated.
In 2015, using Raspberry Pi 2 hardware, is there still any advantage to moving the root file system and booting from an external USB flash drive instead of just using the default microSD card?
I'm not sure if the raspberry pi bootloader is even capable of booting from USB, but I could be mistaken (there might be a way to set up an SD card to act as an intermediate step in mounting the OS from USB).
Aside from that, I can't imagine you'll notice much of a speed difference between the micro sd and a USB 2 flash drive (as far as I'm aware, the rpi doesn't have usb 3 hardware). Both will have similar life span.
Other considerations: power consumption (I believe SD has an advantage here, especially since a card will have to be used anyway to boot), quality of either device (you can buy really bad SD cards and USB flash drives alike)
I would be interested in seeing some bench marks if you decide to run any tests to see if there's a difference.
My DriveSpeed benchmark measures speed of large and small file writes and reads, plus random writing and reading. RPi 2 results for SD and USB drives are here.
http://www.roylongbottom.org.uk/Raspberry%20Pi%20Benchmarks.htm#anchor21
For booting, you need to establish which performance feature is more important and it is not just large file data transfer speed. Anyway, it mainly depends on the drive hardware performance characteristics. My system SD card can be out performed by SD cards in a USB card reader.

How to bind SD card to Raspberry Pi

Is there a way to make sure that SD card of Raspberry PI works only with particular device only?
I do not want anyone to use the SD card with any other Raspberry Pi device other than specified.
Is there a way out?
There is no simple way do do this. Of course you can build some trickeries based on Device Informations (fsys and udev) and crypt your disk. But, it is clearly impossible to guarantee system integrity when the storage device is physically reachable: anyone can mount it and some aware/clever guy, using enough time and effort, shall reverse engineering it.
See this guide for Arch linux: https://wiki.archlinux.org/index.php/Disk_Encryption
If you encrypt your filesystem only he have the password can decrypt the sdcard. This prevent unauthorize access for example from the Windows/Linux to the sd card files.
But if you boot from the PC you are in the same problem.
The only thing that comes to mind is to make a script that controls a device that exists only on raspberry is available and if not, automatically encrypt the system.