Questions tagged [spi]

Serial Peripheral Interface (SPI) is a serial, synchronous bus commonly used in embedded systems. It is most often used for communication between a microcontroller and peripheral hardware such as memories, shift registers, sensors, displays etc, but can also be used for MCU to MCU communication.

Serial Peripheral Interface (SPI) is a serial, synchronous, full duplex bus commonly used in embedded systems. It is most often used for communication between a microcontroller and peripheral hardware such as memories, shift registers, sensors, displays etc, but can also be used for MCU to MCU communication.

SPI was originally developed by Motorola as a hardware peripheral in their microcontroller products. It has become an industry de facto standard and pretty much every MCU made today has got hardware support for SPI. It is however possible to implement SPI without hardware support: a software-controlled SPI communication can be created by using only general-purpose I/O pins, so called "bit-banging".

SPI can be used either as a point-to-point communication between one node called master and another called slave, or as a system with one master and multiple slaves. The latter can be achieved by using either multiplexer circuitry on the slave select line or a so-called daisy chain implementation.

SPI consists of 4 digital signals:

  • MOSI, Master Output Slave Input. Data line for transmission from the master to the slave.
  • MISO, Master Input Slave Output. Data line for transmission from the slave to the master.
  • SCLK, Serial Clock (sometimes called SCK or just CLK)). The clock used for all synchronization, generated by the master.
  • SS, Slave Select. Chip select for the slave(s), active low signal.

Tag usage

Use this tag in combination with and the tag for the MCU being used, if applicable. For hardware-related questions, use https://electronics.stackexchange.com.


References

1385 questions
3
votes
1 answer

Golang and SPI - trying to init RF522 drive

I have a simple Python code that does initalize MFRC522 device properly: import spidev mode_reset = 0x0F def spi_transfer(data): r = spi.xfer2(data) return r def dev_write(address, value): r =…
jdevelop
  • 12,176
  • 10
  • 56
  • 112
3
votes
1 answer

Java play AAC encoded audio ( JAAD decoder )

I have struggled with playing aac encoded audio files with Java a while now. We had a group project at the end of our first semester and wanted to have a background music and few soundeffects in there. At the end we used WAV files, as we couldn't…
9Lukas5
  • 81
  • 9
3
votes
1 answer

STM32F072RB does not receive/send data over SPI in slave mode

I am using the STM32F072RB uC to receive and transmit data over SPI2 in slave mode with the following configuration: CR1 = 0x0078 CR2 = 0x0700 AFRH = 0x55353500 MODER = 0xa2a0556a The register APB1ENR is also properly configured. The current…
Pika
  • 51
  • 7
3
votes
2 answers

Microchip Starter Kits with SPI mode

I want to use microcontrollers for communicating data by SPI. So, I have chosen firstly the Microchip USB Starter Kit III module which has a PIC32MX470F512L. I tried several ways to code its SPI, but only the clock signal SCK can be seen on an…
Dey
  • 33
  • 2
3
votes
2 answers

STM32 and SD card (FATFS and SPI)

I'm starting to work with a stm32l0 board and it was fine until I had some more interesting functions to use. I never read SD card out of windows, I found Pins links and started to read about SPI which could be a suitable solution for our prject (I…
Blaitox
  • 33
  • 1
  • 1
  • 4
3
votes
1 answer

SPI linux driver

I am trying to learn how to write a basic SPI driver and below is the probe function that I wrote. What I am trying to do here is setup the spi device for fram(datasheet) and use the spi_sync_transfer()api description to get the manufacturer's id…
3
votes
3 answers

I2C & SPI driver

Recently, I have been writing a camera driver use I2C interface read/write registers, and use spi interface to write firmware data to it. So my question is how to obtain a spi_device pointer in the I2C driver? Thanks.
cloundliu
  • 31
  • 3
3
votes
1 answer

SDcard initialization issue using SPI on STM32F303

I am trying to initialize SDCard using SPI on STM32F303 when I sent CMD0 command which is (0x40 0x00 0x00 0x00 0x00 0x95) and I tried to have a look of the signal that is coming from MOSI on the oscilloscope I saw different signal as shown below.…
3
votes
1 answer

Raspberry Pi 2, how to disable device_tree to enable SPI?

I have a Raspberry Pi 2, Model B, and I'd like to use the SPI to talk to another Pi (for later using it for more SPI-devices). I'd also like to use WiringPi for C-coding my program. I thought I would ensure I had everything I needed, so i ran a full…
Rasmus Bækgaard
  • 737
  • 2
  • 11
  • 27
3
votes
1 answer

Maven packaging fail Lucene, SPI does not exist Exception

I built a Java application for indexing. I am using Apache Lucene 5.3.1. When I run the application in IDE (IntelJ IDEA 2016.1.1 Community Edition), it runs normally. When I try to run the application from jar file I get this exception Exception in…
3
votes
1 answer

Initializating SanDisk SD card using SPI fails after doing HW reset

I am using an STM32 micrcocontroller to interface an SD card memory using the SPI peripheral. I have done tests with 2Gb , 4Gb , 8Gb and 16Gb SanDisk cards. When I perform a reset with the 2Gb and 8Gb cards , nothing happens and I keep going with my…
Y.G
  • 51
  • 2
  • 8
3
votes
1 answer

Arduino softwareserial clashing with SPI?

I have an Arduino project that is using an nRF24l01+ radio module over SPI (using this library: http://tmrh20.github.io/RF24/) and an RFID reader over softwareserial. I am sleeping my Arduino and having them wake it up via interrupt when a message…
MaxStrange
  • 137
  • 1
  • 10
3
votes
1 answer

When putting an SD/MMC card into SPI mode, can CS go high in between bytes?

I have a microprocessor with the card's chip select (CS) line tied to a 'frame' signal automatically driven by the SPI (SSP) circuit. This causes CS to go high between each byte. The MMC/SD specs require that CS be held low in order to enter SPI…
Justin Love
  • 4,397
  • 25
  • 36
3
votes
1 answer

What's the relationship between GPIO and SPI?

I found GPIO driver in the kernel leave /sys/class/gpio to control gpio, but I found GPIO can be controlled by /dev/mem as well, I found this mapping may be done in the spi-bcm2708 (which call the __ioremap as a platform driver), but I don't…
ggaaooppeenngg
  • 1,323
  • 3
  • 17
  • 27
3
votes
1 answer

Input Signal Edge Detection on FPGA

I am trying to interface a Virtex 4 (ML401) FPGA and a TIVA C series board using 4 wire SPI (cs, sclk, miso, mosi). The tiva acts as a master and the FPGA as a slave. I am able to receive the SPI data from the master and display the data on the…
JagPK
  • 148
  • 1
  • 9