Simulation SPI bus communication technology based on SPCE061A and PTR8000

Publisher:tony520Latest update time:2016-05-09 Source: eefocusKeywords:SPCE061A  PTR8000 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  SPI (Serial Peripheral Interrace) is a synchronous serial communication bus introduced by Motorola. It is used for serial connection between microprocessors/microcontrollers and peripheral expansion chips and has now developed into an industrial standard. PTR8000 wireless communication module of Xuntong Technology is a device with SPI as the communication interface. Due to its superior performance, it is widely used in many fields. Its SPI interface needs to occupy four I/O lines of the microprocessor. SPCE061A is a 16-bit microcontroller with voice function launched by Lingyang Company. It has rich I/O resources but does not have SPI interface. In practical applications, for the consideration of product volume, cost, scalability and application occasions, we choose to combine the two to form a wireless communication system and use software simulation to realize SPI serial port communication. Due to space limitations, only the timing of read commands and application subroutines are introduced. This method is also applicable to the communication between other MCUs that do not have SPI interface and SPI interface devices.

  1 SPCE061A board and PTR8000 hardware connection

  Figure 1 shows the hardware connection diagram of SPCE061A microcontroller and PTR8000.

  2 Working principle of SPI bus of PTRS000 communication module

  The PTR8000 communication module acts as a slave device, and its SPI interface uses four I/O lines: the serial clock line SCK, the output data line MISO, the input data line MOSI, and the high-level effective slave select line CSN. The PTR8000 SPI bus interface read command timing is shown in Figure 2. The write command is shown in Figure 3.

  3. Implementation method of software simulation SPI interface

  For the SPCE061A microcontroller that does not have an SPI serial bus interface, software can be used to simulate the operation of SPI. In Figure 1, IOB1 simulates the data output terminal SDO of the SPI master device, IOB0 simulates the clock output terminal SCK of the SPI, IOA4 simulates the slave selection terminal CSN of the SPI, and IOB9 simulates the data input terminal SDI of the SPI.

  After power-on reset, the initial state of IOB0 (SCK) is first set to 0 (idle state).

  Read operation: SPCE061A first sends 1 start bit (1), 2 operation codes (10), and 6 data addresses to be read through IOB1 port, then reads 1 empty bit through IOB9 port, and then reads 16 bits of data (high bit first).

  Write operation: SPCE061A first sends 1 start bit (1), 2 operation codes (01), and 6 data addresses to be written through the IOB1 port, and then sends the 16-bit data to be written (high bit first) through the IOB1 port. A write enable command must be sent before the write operation, and a write disable command must be sent after the write operation.

  Write enable operation (WEN): A write operation first sends a 1-bit start bit (1), a 2-bit operation code (00), and 6-bit data (11XXXX).

  Write disable operation (WDS): The write operation first sends a start bit (1), a 2-bit operation code (00), and 6 bits of data (00XXXX).

  The following introduces the subroutine for simulating SPI using SPCE061A.

 


  For different serial interface peripheral chips, their clock timing is different. The above subroutines are for devices that input (receive) data on the rising edge of SCK and output (send) data on the falling edge. These subroutines are also applicable to various other serial peripheral interface chips that input on the rising edge and output on the falling edge of the serial clock. Just change the output level sequence of IOB0 (SCK) in the program and make corresponding adjustments.

  4 Conclusion

  This article introduces the method of realizing data transmission between non-SPI interface microcontroller and SPI interface memory by software simulation of SPI bus interface, and gives a subroutine written by SPCE061A to simulate SPI serial bus reading PTR8000. This method is also applicable to other microcontrollers, ARM, microcomputers, etc.

Keywords:SPCE061A  PTR8000 Reference address:Simulation SPI bus communication technology based on SPCE061A and PTR8000

Previous article:μC/OS-II Porting Notes 1 (FreeScale 68HCS12 Core MCU)
Next article:Classic application of flag bits in single-chip C language

Recommended ReadingLatest update time:2024-11-16 22:38

Intelligent blood parameter analysis system based on SPCE061A
    With the development of intelligent control, the analysis of blood cell status and parameters has also been continuously using the latest electronic, optical, chemical and computer technologies to meet the requirements of clinical work for blood cell analysis. Intelligent instruments can reduce the intensity of man
[Microcontroller]
Intelligent blood parameter analysis system based on SPCE061A
Design of Remote Upgrade of Single Chip Microcomputer Program
1. Introduction Single-chip microcomputers are widely used. In some cases, it is inevitable to upgrade the internal program of single-chip microcomputers, but it is often necessary to recall the single-chip microcomputer products to achieve this. This is very inconvenient for the program upgrade of some remote
[Microcontroller]
Design of Remote Upgrade of Single Chip Microcomputer Program
Design of hip force tester using SPCE061A single chip microcomputer
1 Introduction With the continuous improvement of the scientific level of sports training, the necessity of special strength training for the human body has been increasingly valued. Through the overall analysis of a large number of actual sports test data, it is found that the backward extension force of all a
[Microcontroller]
Design of hip force tester using SPCE061A single chip microcomputer
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号