Question about STM32 SPI slave mode

Publisher:达文西happyLatest update time:2019-01-16 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

There are many questions about using STM32 as a slave on the Internet. The main problem is that the slave receives data incorrectly.


1 About the master and slave clock suspension configuration It can be said with certainty that the master and slave clock suspension must be configured to be the same 


This is clearly stated in the official STM manual.


2 The baud rate of the slave is only related to the CLK signal provided by the master.


3 Communication failure or data reception error The problem lies in the slave's judgment of the SPI start signal.


When using TI mode, the NSS signal is easily captured by the hardware slave. 


What if there is no NSS signal? Because the STM32 SPI normal mode does not do anything to capture data, it really confuses us.


It just starts capturing when we turn on SPI, regardless of whether SCK is idle or busy at this time, which causes the SPI data we read to be wrong


Solving this problem is also very simple. Just process the SPI signal in the software to get whether the SPI line is busy or idle.


It is basically the timing of capturing the SPI signal


Before we capture, we first check the SPI bus. If the SPI bus is idle, we start SPI to capture data.


If the bus SPI is busy, wait for the bus to be idle before capturing. It has been verified that this method has almost no problem in communication success rate.

Keywords:STM32 Reference address:Question about STM32 SPI slave mode

Previous article:stm32 spi slave mode configuration solution
Next article:STM32 SPI SLAVE

Recommended ReadingLatest update time:2024-11-16 19:54

How to generate lib for secondary development in STM32
Related methods: 0 STM32 latest firmware library (3.5) package lib plus project template 1 stm32 teaches you how to compile LIB files    2 How to generate lib for stm32 3Teach you how to generate lib files in stvd, you know the benefits~ 4Who knows how to generate lib files under RVMDK? 5 How to package y
[Microcontroller]
STM32 system learning - RCC (using HSE/HSI to configure clock)
RCC: reset clock control reset and clock controller. Mainly explain the clock part, especially the clock tree. After understanding the clock tree, you will know the ins and outs of all the clocks of STM32. 1. The main function of RCC - clock part  Set the system clock SYSCLK, set the AHB division factor (determine
[Microcontroller]
STM32 system learning - RCC (using HSE/HSI to configure clock)
STM32 RTC principle
1. RTC clock block diagram analysis (important) First, let’s get familiar with a few knowledge points:       1. The real-time clock (RTC) of STM32 is an independent timer!       2. The RTC module and the clock configuration system (RCC_BDCR register) are in the backup area, that is, the RTC settings and time rem
[Microcontroller]
STM32 RTC principle
STM32 RAM debugging
       RAM2.ini /******************************************************************************/ /* RAM.INI: RAM Initialization File                                           */ /******************************************************************************/ // Use Configuration Wizard in Context
[Microcontroller]
STM32 RAM debugging
Simple digital voltmeter + ADC0832 + serial SPI mode to achieve 1-way data conversion
1 Objects and models (1) Why are the DO and DI pins connected to one pin? Since ADC0832 does not use the DO and DI ports at the same time during communication, and the interface between the DO and DI ports and the microcontroller is bidirectional, a wire can be used to connect the DO and DI ports
[Microcontroller]
Simple digital voltmeter + ADC0832 + serial SPI mode to achieve 1-way data conversion
Detailed explanation of time.h file in STM32
The time.h file of STM32 has the definition of the time structure and related functions of time conversion. struct tm {     int tm_sec; /* seconds after the minute, 0 to 60                      (0 - 60 allows for the occasional leap second) */     int tm_min; /* minutes after the hour, 0 to 59 */     int tm_hour; /*
[Microcontroller]
Detailed explanation of time.h file in STM32
STM32 Flash read and write; Flash address corresponding storage content and method
Concept: The smallest unit of information in a computer is a bit, which is a binary bit. 8 bits make up a Byte, which is 1 byte. 1 storage unit stores 1 byte, and each storage unit corresponds to a 32-bit address, so it is important to say it three times: For a 32-bit ARM CPU A 32-bit address points to 1 byte!!! A 32-
[Microcontroller]
Design of TFT digital color screen with STM32 direct driving RGB interface
Introduction With the continuous development of industrial technology, the development and application of human-machine interface are unprecedentedly hot. In order to have a more friendly human-machine interface, TFT digital color screens are widely used, but TFT color screens usually do not have controllers, so ther
[Microcontroller]
Design of TFT digital color screen with STM32 direct driving RGB interface
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号