Cypress SPI RAM Memories on Raspberry Pi

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GernotH_31
Employee
Employee
First like received

Sometimes it is useful to have a simple and easy-to-use development & test platform at hand. The popular Raspberry Pi platform meets these needs. It is inexpensive, popular and easy to set up.

The SPI controller that is integrated into the Pi's Broadcom SOCs supports single I/O SPI with frequencies of up to 125 MHz. Two chip selects are available on the 40-pin expansion connector. DMA from and to SPI devices is supported as well. Supply and I/O voltages are normally 3.3V.

The following instructions summarize how to set up the Cypress SPI Memories Driver for Linux on a Raspberry Pi.

1. Kernel Compilation

Pick a suitable Linux kernel (e.g. branch rpi-4.14.y) and follow the official kernel build instructions. Apply the Cypress SPI Driver patch to the kernel tree and enable CONFIG_MTD_CY_SPIMEM and CONFIG_MTD_CY_HAL_GENERIC in the configuration menu.

2. Device Tree Settings

Edit the device tree file of your Raspberry Pi (e.g. arch/arm/boot/dts/bcm2710-rpi-3-b.dts for the Raspberry Pi 3 Model B). In the SPI device section, reduce the SPI clock frequency from 125 MHz to e.g. 25 MHz and change the driver from “spidev” to “cy-spimem”) as highlighted in the following dts snapshot:

      &spi0 {

      pinctrl-names = "default";

      pinctrl-0 = <&spi0_pins &spi0_cs_pins>;

      cs-gpios = <&gpio 8 1>, <&gpio 7 1>;

      spidev0: spidev@0{

            compatible = "cy-spimem";

            reg = <0>;  /* CE0 */

            #address-cells = <1>;

            #size-cells = <0>;

            spi-max-frequency = <25000000>;

      };

3. Hardware Setup

Attach a SPI memory device to the SPI pins of the 40-pin expansion connector.

20200510_131823_resized.jpg

4. Boot the System

If everything has been set up correctly, the SPI memory device is probed and reported in the kernel boot log

            Found Cypress CY15B104Q (F-RAM)

and registered as a MTD device

# cat /proc/mtd

dev:    size erasesize  name

mtd0: 00080000 00000200 "CY15B104Q"

Afterwards, it can be accessed via standard Linux tools.

0 Replies