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
4
votes
1 answer

Use GPIO as chip select for SPI ACPI overlay

I want to use a GPIO pin as a new chip select for SPI on an Up Squared board. The Up squared uses an Intel Pentium N4200, so it's a x86 machine. I have managed to this on a Raspberry Pi by using Device Tree Overlays but as this is an x86 machine I…
afvmil
  • 362
  • 3
  • 11
4
votes
3 answers

How will circular DMA periph to memory behave at the end of the transfer in STM32?

I wanted to ask, how will behave DMA SPI rx in STM32 in following situation. I have a specified (for example) 96 Bytes array called A which is intended to store the data received from the SPI. I turn on my circular SPI DMA which operates on each…
Sink
  • 91
  • 1
  • 2
  • 9
4
votes
2 answers

Using spi-bitbang driver

I am writing a kernel module to read and write to SPI device (CC1200). My linux device does not have native SPI, so I am trying to bit-bang the bus. I found that linux has built-in bitbang code (linux/spi/spi_bitbang.h), but I am confused how to set…
Maros Macko
  • 89
  • 1
  • 7
4
votes
2 answers

STM32, master and slave devices not responding to each other

Dear stack overflow users, I have built a device with a master device, and a network of 10 slaves. All of them communicate via 4 wire SPI. Right now I am writing the program for both boards, and they don't seem to be working, I do not get expected…
Marek Ant
  • 67
  • 7
4
votes
1 answer

Where is the SPI multiplexer of my dreams?

Consider you have an SPI bus with only a single chip select. Is there a chip such that I can connect 8 or more devices to that SPI bus? To simplify things, you may assume that all devices agree on the SPI mode (data needs to be valid on a rising…
Sven
  • 1,364
  • 2
  • 17
  • 19
4
votes
1 answer

SPI_IOC_MESSAGE(N) on Raspberry Pi 3

I am working on a project on a Raspberry Pi 3, and I saw this code line : ioctl(sSpiObj.spiFd, SPI_IOC_MESSAGE(1), &sSpiTransfer); I don't know what SPI_IOC_MESSAGE(1) does, and I tried to find on the internet its explanation, but I…
hasan bucak
  • 75
  • 1
  • 1
  • 8
4
votes
1 answer

Send data over SPI using STM32 mcu and Low Level LL APIs

My board is a nucleo STM32L432KCU board. I'm trying to send a character over SPI using the Low Level API. The SPI is configured as "Transmit only master" and the hardware NSS signal is disabled. Unfortunately, my code is not working (see below).…
Alexis
  • 576
  • 1
  • 10
  • 29
4
votes
3 answers

USB to SPI converter

I have a chip that uses SPI for communication and would like to connect it directly to the USB port on my computer. Does anyone have experience with using a USB to SPI converter? Any recommendations? Quick searches on the web…
umps
  • 1,119
  • 4
  • 15
  • 25
4
votes
2 answers

USB to GPIO/SPI/I2C/UART for regular Windows 10 PC? Simular to Raspberry Pi 40 pin Header

Does anybody know of a company that sells a USB cable for a normal non-IoT windows 10 PC that can converts a USB to all of the following buses on 40 pin Raspberry pi like header? Example: USB->GPIO,I2C,SPI,UART, etc.. The closest thing I can find…
Bimo
  • 5,987
  • 2
  • 39
  • 61
4
votes
1 answer

Setting nss_soft in Master (SPI)

I want to set the NSS pin to software mode in master using Nucleo STM32F103RB. In the reference manual, they say, In NSS Software mode, set the SSM and SSI bits in the SPI_CR1 register. If the NSS pin is required in output mode, the SSOE bit only…
Muzahir Hussain
  • 1,009
  • 2
  • 16
  • 35
4
votes
2 answers

M95128-W EEPROM. First byte of each page not writing or reading correctly

I am working on a library for controlling the M95128-W EEPROM from an STM32 device. I have the library writing and reading back data however the first byte of each page it not as expected and seems to be fixed at 0x04. For example I write 128 bytes…
Daniel Beyzade
  • 107
  • 1
  • 10
4
votes
1 answer

stm32 SPI + DMA

I try to send data with SPI using DMA channel. When I send without DMA everything is OK, but with DMA sth is wrong. When I debug my program SPI DR register is always 0. I would like to use dma circular mode to send my array all the time. There is my…
kmbm
  • 115
  • 2
  • 9
4
votes
1 answer

SPI Reset on Raspberry Pi after GPIO usage

I found out when I used GPIO Pins which are also SPI Pins (GPIO8,9,10,11) and clean them up. I can not reuse this Pins for an SPI connection. I have to restart the Raspberry Pi first to use SPI again. Do you have an idea how I can reset this Pins…
user1200794
  • 159
  • 3
  • 9
4
votes
1 answer

STM32L4 - SPI2 clocking issue

I am currently working on the STM32L476RG Nucleo board and I am trying to communicate with the SPI2 bus. It seems that I am sending data with the MOSI pin but I don't have anything on the SCK pin. Here are my initialisation code and sending data…
Tetris
  • 49
  • 2
4
votes
1 answer

Send HEX values to SPI on a Raspberry PI B+

I have a LED strip that I want to control with my Raspberry PI. I have connected it to the GPIO10 (MOSI) and GPIO11 (CLK). The SPI module is loaded in Raspbian. I have created a file that I send to /dev/spidev-0.0, when i do that i can control the…
Rickard
  • 620
  • 2
  • 7
  • 23
1 2
3
92 93