TW201418992A - Data transmission control method and device of serial peripheral interface master device - Google Patents

Data transmission control method and device of serial peripheral interface master device Download PDF

Info

Publication number
TW201418992A
TW201418992A TW101141104A TW101141104A TW201418992A TW 201418992 A TW201418992 A TW 201418992A TW 101141104 A TW101141104 A TW 101141104A TW 101141104 A TW101141104 A TW 101141104A TW 201418992 A TW201418992 A TW 201418992A
Authority
TW
Taiwan
Prior art keywords
transmission control
data
data transmission
leading edge
peripheral interface
Prior art date
Application number
TW101141104A
Other languages
Chinese (zh)
Inventor
Jyh-Hwang Wang
Hsiang-Feng Hsu
Original Assignee
Megawin Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Megawin Technology Co Ltd filed Critical Megawin Technology Co Ltd
Priority to TW101141104A priority Critical patent/TW201418992A/en
Publication of TW201418992A publication Critical patent/TW201418992A/en

Links

Abstract

A data transmission control method of serial peripheral interface (SPI) master device includes: providing a clock signal, which includes a plurality of cycles, and each cycle includes a leading edge and a trailing edge; sampling data at a sampling data point, wherein the sampling data point is arranged between the leading edge and the trailing edge of current cycle in the cycles; and changing data in a changing data point, wherein the changing data point is arranged between the trailing edge of the current cycle and the leading edge of a next cycle of the current cycle. The above-mentioned data transmission control method can meet four data transmission mode defined by SPI specifications simultaneously. A data transmission control device of SPI master device is also disclosed.

Description

序列周邊介面主裝置之資料傳輸控制方法及裝置 Data transmission control method and device for serial peripheral interface main device

本發明是有關一種資料傳輸控制方法及裝置,特別是一種序列周邊介面主裝置之資料傳輸控制方法及裝置。 The invention relates to a data transmission control method and device, in particular to a data transmission control method and device for a serial peripheral interface main device.

序列周邊介面(serial peripheral interface,SPI)定義了時脈極性(clock polarity,CPOL)位元以及時脈相位(clock phase,CPHA)位元以供使用者設定所需之資料傳輸模式。請參照圖1,CPOL=0時,SPI主裝置(master device)產生之時脈SCK中,上升緣(rising edge)為週期之前緣(leading edge),下降緣(falling edge)為週期之後緣(trailing edge)。而CPOL=1時,SPI主裝置產生之時脈SCK中,下降緣為週期之前緣,上升緣為週期之後緣。 The serial peripheral interface (SPI) defines a clock polarity (CPOL) bit and a clock phase (CPHA) bit for the user to set the desired data transmission mode. Referring to FIG. 1, when CPOL=0, in the clock SCK generated by the SPI master device, the rising edge is the leading edge and the falling edge is the trailing edge of the period ( Trailing edge). When CPOL=1, in the clock SCK generated by the SPI master device, the falling edge is the leading edge of the cycle, and the rising edge is the trailing edge of the cycle.

請再參照圖1,CPHA=0時,主裝置是在週期之後緣處改變主裝置輸出之資料MOSI,如虛線箭號所示;在週期之前緣處取樣從屬裝置(slave device)輸出之資料MISO,如實線箭號所示。請參照圖2,CPHA=1時,主裝置是在週期之前緣處改變主裝置輸出之資料MOSI,如虛線箭號所示;在週期之後緣處取樣從屬裝置輸出之資料MISO,如實線箭號所示。因此,序列周邊介面總共定義四種資料傳輸模式,亦即CPOL=0、CPHA=0;CPOL=1、CPHA=0;CPOL=0、CPHA=1以及CPOL=1、CPHA=1。為符合上述規格,造成SPI裝置之電路設計的複雜度增加。 Referring again to FIG. 1, when CPHA=0, the master device changes the data MOSI outputted by the master device at the trailing edge of the cycle, as indicated by the dotted arrow; and samples the data output from the slave device at the leading edge of the cycle. As shown by the solid arrow. Referring to FIG. 2, when CPHA=1, the master device changes the data MOSI outputted by the master device at the leading edge of the cycle, as indicated by the dotted arrow; and samples the data MISO output from the slave device at the edge of the cycle, such as the solid arrow. Shown. Therefore, a total of four data transmission modes are defined in the sequence peripheral interface, that is, CPOL=0, CPHA=0; CPOL=1, CPHA=0; CPOL=0, CPHA=1, and CPOL=1, CPHA=1. In order to meet the above specifications, the complexity of the circuit design of the SPI device is increased.

綜上所述,如何簡化SPI裝置之電路設計便是目前極需努力的目標。 In summary, how to simplify the circuit design of the SPI device is currently the goal of great efforts.

本發明提供一種序列周邊介面主裝置之資料傳輸控制方法及裝 置,其是以單一資料傳輸模式同時滿足SPI規格所定義的四種資料傳輸模式,因此能夠以較為簡單之電路設計實現SPI主裝置。 The invention provides a data transmission control method and device for a serial peripheral interface main device It is a four-data transmission mode defined by the SPI specification in a single data transmission mode, so the SPI master can be realized with a relatively simple circuit design.

本發明一實施例之序列周邊介面主裝置之資料傳輸控制方法包含:提供一時脈訊號,其包含多個週期,且每一週期包含一前緣以及一後緣;於一取樣資料點取樣資料,其中取樣資料點在多個週期中之一目前週期之前緣以及後緣之間;以及於一改變資料點改變資料,其中改變資料點在目前週期之後緣以及目前週期之下一週期之前緣之間。 The data transmission control method of the sequence peripheral interface main device according to an embodiment of the present invention includes: providing a clock signal including a plurality of periods, and each period includes a leading edge and a trailing edge; sampling data at a sampling data point, Wherein the sampled data points are between the leading edge and the trailing edge of the current cycle of one of the plurality of cycles; and the data is changed at a change point, wherein the change of the data point is between the trailing edge of the current cycle and the leading edge of the current cycle .

本發明另一實施例之序列周邊介面主裝置之資料傳輸控制裝置包含一時脈產生器以及一資料控制器。時脈產生器用以提供一時脈訊號,其包含多個週期,且每一週期包含一前緣以及一後緣。資料控制器用以於一取樣資料點取樣資料以及於一改變資料點改變資料,其中取樣資料點在多個週期中之一目前週期之前緣以及後緣之間;以及改變資料點在目前週期之後緣以及目前週期之下一週期之前緣之間。 A data transmission control device for a serial peripheral interface host device according to another embodiment of the present invention includes a clock generator and a data controller. The clock generator is configured to provide a clock signal including a plurality of periods, and each period includes a leading edge and a trailing edge. The data controller is configured to sample data at a sampling data point and change data at a change data point, wherein the sampling data point is between the leading edge and the trailing edge of one of the plurality of cycles; and changing the data point after the current cycle And between the leading edge of the current cycle below the current cycle.

以下藉由具體實施例配合所附的圖式詳加說明,當更容易瞭解本發明之目的、技術內容、特點及其所達成之功效。 The purpose, technical contents, features, and effects achieved by the present invention will become more apparent from the detailed description of the appended claims.

本發明之序列周邊介面主裝置之資料傳輸控制方法及裝置是以單一資料傳輸模式同時滿足SPI規格所定義的四種資料傳輸模式,因此能夠以簡化之電路設計實現SPI主裝置。可以理解的是,未在以下詳細說明之相關技術內容,可遵循SPI規格。 The data transmission control method and device of the sequence peripheral interface main device of the present invention can satisfy the four data transmission modes defined by the SPI specification in a single data transmission mode, so that the SPI master device can be realized with a simplified circuit design. It will be understood that the relevant technical content not described in detail below may follow the SPI specification.

請參照圖3以及圖4,以說明本發明之一實施例之序列周邊介面主裝置之資料傳輸控制方法。首先,提供一時脈訊號SCK,其包含多個週期,且每一週期包含一前緣以及一後緣(S31)。可以理解的是,若為CPLO=0之時脈訊號SCK,前緣即為週期之上升緣,後緣即為週期之下降緣。若為CPLO=1之時脈訊號SCK,前緣即為週期之下降緣,後 緣即為週期之上升緣。接著,於一取樣資料點取樣資料(S32)或於一改變資料點改變資料(S33),其中取樣資料點是在多個週期中之一目前週期之前緣以及後緣之間;而改變資料點則是在目前週期之後緣以及目前週期之下一週期之前緣之間。 Referring to FIG. 3 and FIG. 4, a data transmission control method for a serial peripheral interface master device according to an embodiment of the present invention is described. First, a clock signal SCK is provided, which includes a plurality of periods, and each period includes a leading edge and a trailing edge (S31). It can be understood that if the clock signal SCK is CPLO=0, the leading edge is the rising edge of the cycle, and the trailing edge is the falling edge of the cycle. If the clock signal SCK is CPLO=1, the leading edge is the falling edge of the cycle, after The edge is the rising edge of the cycle. Then, sampling data at a sampling data point (S32) or changing data at a change point (S33), wherein the sampling data point is between the leading edge and the trailing edge of one of the plurality of cycles; and changing the data point It is between the trailing edge of the current cycle and the leading edge of the current cycle.

請參照圖4,說明SPI主裝置依據時脈訊號SCK(CPLO=0;CPLO=1)產生訊號MOSI。首先,週期1是在啟始週期之後緣以及週期1之前緣之間改變資料,週期2則是在週期1之後緣以及週期2之前緣之間改變資料,如虛線箭號所示,以下類推。如此,SPI主裝置即可產生欲輸出之訊號MOSI。依據圖4所示之主裝置所輸出之時脈訊號SCK以及訊號MOSI,從屬裝置不論在時脈訊號SCK之週期前緣(CPHA=0)或後緣(CPHA=1)取樣皆可取得正確之資料,如實線之箭號所示。請參照圖5,依據主裝置所輸出之時脈訊號SCK,從屬裝置在週期之前緣處(CPHA=1)或後緣處(CPHA=0)改變資料(如虛線之箭號所示)以產生訊號MISO,主裝置在週期之前緣以及後緣之間取樣亦可取得正確之資料,如實線之箭號所示。 Referring to FIG. 4, the SPI master device generates a signal MOSI according to the clock signal SCK (CPLO=0; CPLO=1). First, cycle 1 changes the data between the trailing edge of the start cycle and the front edge of cycle 1, and cycle 2 changes the data between the trailing edge of cycle 1 and the front edge of cycle 2, as indicated by the dashed arrow, and so on. In this way, the SPI master can generate the signal MOSI to be output. According to the clock signal SCK and the signal MOSI outputted by the master device shown in FIG. 4, the slave device can obtain the correct sampling regardless of the cycle leading edge (CPHA=0) or the trailing edge (CPHA=1) of the clock signal SCK. Information, as indicated by the arrow of the solid line. Referring to FIG. 5, according to the clock signal SCK output by the master device, the slave device changes the data (shown by the arrow of the dotted line) at the front edge of the cycle (CPHA=1) or the trailing edge (CPHA=0) to generate Signal MISO, the main device can also obtain the correct data by sampling between the leading edge and the trailing edge of the cycle, as indicated by the arrow of the solid line.

於一實施例中,為了正確取樣資料,取樣資料點可在週期之前緣以及後緣之間之中間點,如圖4所示。同理,改變資料點可在目前週期之後緣以及下一週期之前緣之間之中間點,如圖5所示。需注意者,圖4以及圖5所示實施例僅是例示說明而非用以限制本發明。 In an embodiment, in order to correctly sample the data, the sampled data points may be at an intermediate point between the leading edge and the trailing edge of the cycle, as shown in FIG. Similarly, changing the data point can be at the middle point between the trailing edge of the current cycle and the leading edge of the next cycle, as shown in Figure 5. It is to be noted that the embodiments shown in Figures 4 and 5 are merely illustrative and are not intended to limit the invention.

請參照圖6,本發明一實施例之序列周邊介面主裝置之資料傳輸控制裝置包含一時脈產生器61以及一資料控制器62。時脈產生器61用以提供一時脈訊號SCK,包含多個週期,且每一週期包含一前緣以及一後緣。資料控制器62用以於一取樣資料點取樣資料以及於一改變資料點改變資料,其中取樣資料點在多個週期中之一目前週期之前緣以及後緣之間;以及改變資料點在目前週期之後緣以及目前週期之下一週期之前緣之間。本發明之序列周邊介面主裝置之資料傳輸控制裝置如何取樣資料以及改變資料已如前所述,在此不再贅述。 Referring to FIG. 6, a data transmission control apparatus for a serial peripheral interface main device according to an embodiment of the present invention includes a clock generator 61 and a data controller 62. The clock generator 61 is configured to provide a clock signal SCK, including a plurality of periods, and each period includes a leading edge and a trailing edge. The data controller 62 is configured to sample data at a sampling data point and change data at a change data point, wherein the sampling data point is between a front edge and a trailing edge of one of the plurality of cycles; and changing the data point in the current cycle The trailing edge and the leading edge of the current cycle below the current cycle. The data transmission control device of the sequence peripheral interface master device of the present invention has been sampled and changed data as described above, and will not be described herein.

綜合上述,本發明之序列周邊介面主裝置之資料傳輸控制方法及 裝置以單一資料傳輸模式即可同時滿足SPI規格所定義的四種資料傳輸模式,因此SPI主裝置能夠以簡化之電路設計加以實現。 Combining the above, the data transmission control method of the serial peripheral interface main device of the present invention The device can meet the four data transfer modes defined by the SPI specification in a single data transfer mode, so the SPI master can be implemented with a simplified circuit design.

以上所述之實施例僅是為說明本發明之技術思想及特點,其目的在使熟習此項技藝之人士能夠瞭解本發明之內容並據以實施,當不能以之限定本發明之專利範圍,即大凡依本發明所揭示之精神所作之均等變化或修飾,仍應涵蓋在本發明之專利範圍內。 The embodiments described above are only intended to illustrate the technical idea and the features of the present invention, and the purpose of the present invention is to enable those skilled in the art to understand the contents of the present invention and to implement the present invention. That is, the equivalent variations or modifications made by the spirit of the present invention should still be included in the scope of the present invention.

61‧‧‧時脈產生器 61‧‧‧ Clock Generator

62‧‧‧資料控制器 62‧‧‧ data controller

SCK‧‧‧時脈訊號 SCK‧‧‧ clock signal

MOSI‧‧‧訊號 MOSI‧‧‧ signal

MISO‧‧‧訊號 MISO‧‧‧ signal

S31~S33‧‧‧序列周邊介面主裝置之資料傳輸控制方法 Data transmission control method for S31~S33‧‧‧ sequence peripheral interface main device

圖1為一時序圖,顯示SPI規格所定義之CPOL=0或1以及CPHA=0之資料傳輸模式。 Figure 1 is a timing diagram showing the data transfer modes of CPOL = 0 or 1 and CPHA = 0 as defined by the SPI specification.

圖2為一時序圖,顯示SPI規格所定義之CPOL=0或1以及CPHA=1之資料傳輸模式。 Figure 2 is a timing diagram showing the data transfer modes of CPOL = 0 or 1 and CPHA = 1 as defined by the SPI specification.

圖3為一流程圖,顯示本發明一實施例之序列周邊介面主裝置之資料傳輸控制方法之步驟。 3 is a flow chart showing the steps of a data transmission control method for a serial peripheral interface master device according to an embodiment of the present invention.

圖4以及圖5為一時序圖,顯示依據本發明一實施例之序列周邊介面主裝置之資料傳輸控制方法之資料傳輸模式。 4 and FIG. 5 are timing diagrams showing data transmission modes of a data transmission control method for a serial peripheral interface master device according to an embodiment of the present invention.

圖6為一方塊圖,顯示本發明一實施例之序列周邊介面主裝置之資料傳輸控制裝置。 FIG. 6 is a block diagram showing a data transmission control apparatus for a serial peripheral interface master device according to an embodiment of the present invention.

S31~S33‧‧‧序列周邊介面主裝置之資料傳輸控制方法 Data transmission control method for S31~S33‧‧‧ sequence peripheral interface main device

Claims (10)

一種序列周邊介面主裝置之資料傳輸控制方法,包含:提供一時脈訊號,其包含多個週期,且每一週期包含一前緣(leading edge)以及一後緣(trailing edge);於一取樣資料點取樣資料,其中該取樣資料點在該多個週期中之一目前週期之該前緣以及該後緣之間;以及於一改變資料點改變資料,其中該改變資料點在該目前週期之該後緣以及該目前週期之下一週期之該前緣之間。 A data transmission control method for a sequence peripheral interface main device includes: providing a clock signal including a plurality of periods, and each period includes a leading edge and a trailing edge; Point sampling data, wherein the sampling data point is between the leading edge and the trailing edge of one of the plurality of cycles; and changing data at a change data point, wherein the changing data point is in the current cycle The trailing edge and the leading edge of a cycle below the current cycle. 如請求項1所述之序列周邊介面主裝置之資料傳輸控制方法,其中該取樣資料點在該目前週期之該前緣以及該後緣之間之中間點。 The data transmission control method of the sequence peripheral interface master device of claim 1, wherein the sample data point is at an intermediate point between the leading edge and the trailing edge of the current period. 如請求項1所述之序列周邊介面主裝置之資料傳輸控制方法,其中該改變資料點在該目前週期之該後緣以及該下一週期之該前緣之間之中間點。 The data transmission control method of the sequence peripheral interface master device of claim 1, wherein the change data point is at an intermediate point between the trailing edge of the current period and the leading edge of the next period. 如請求項1所述之序列周邊介面主裝置之資料傳輸控制方法,其中該前緣為一上升緣。 The data transmission control method of the sequence peripheral interface master device according to claim 1, wherein the leading edge is a rising edge. 如請求項1所述之序列周邊介面主裝置之資料傳輸控制方法,其中該前緣為一下降緣。 The data transmission control method of the sequence peripheral interface master device according to claim 1, wherein the leading edge is a falling edge. 一種序列周邊介面主裝置之資料傳輸控制裝置,包含:一時脈產生器,其用以提供一時脈訊號,該時脈訊號包含多個週期,且每一週期包含一前緣(leading edge)以及一後緣(trailing edge);以及一資料控制器,其用以於一取樣資料點取樣資料以及於一改變資料點改變資料,其中該取樣資料點在該多個週期中之一目前週期之該前緣以及該後緣之間;以及該改變資料點在該目前週期之該後緣以及該目前週期之下一週期之該前緣之間。 A data transmission control device for a serial peripheral interface main device includes: a clock generator for providing a clock signal, the clock signal includes a plurality of periods, and each period includes a leading edge and a a trailing edge; and a data controller for sampling data at a sampling data point and changing data at a change data point, wherein the sampling data point is before the current period of one of the plurality of cycles And between the trailing edge; and the change data point is between the trailing edge of the current period and the leading edge of a period below the current period. 如請求項6所述之序列周邊介面主裝置之資料傳輸控制裝置,其中該取樣資料點在該目前週期之該前緣以及該後緣之間之中間點。 The data transmission control device of the sequence peripheral interface master device of claim 6, wherein the sample data point is at an intermediate point between the leading edge and the trailing edge of the current cycle. 如請求項6所述之序列周邊介面主裝置之資料傳輸控制裝置,其中該 改變資料點在該目前週期之該後緣以及該下一週期之該前緣之間之中間點。 The data transmission control device of the sequence peripheral interface main device according to claim 6, wherein the data transmission control device The intermediate point between the trailing edge of the current period and the leading edge of the next period is changed. 如請求項6所述之序列周邊介面主裝置之資料傳輸控制裝置,其中該前緣為一上升緣。 The data transmission control device of the sequence peripheral interface master device of claim 6, wherein the leading edge is a rising edge. 如請求項6所述之序列周邊介面主裝置之資料傳輸控制裝置,其中該前緣為一下降緣。 The data transmission control device of the sequence peripheral interface main device of claim 6, wherein the leading edge is a falling edge.
TW101141104A 2012-11-06 2012-11-06 Data transmission control method and device of serial peripheral interface master device TW201418992A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW101141104A TW201418992A (en) 2012-11-06 2012-11-06 Data transmission control method and device of serial peripheral interface master device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW101141104A TW201418992A (en) 2012-11-06 2012-11-06 Data transmission control method and device of serial peripheral interface master device

Publications (1)

Publication Number Publication Date
TW201418992A true TW201418992A (en) 2014-05-16

Family

ID=51294332

Family Applications (1)

Application Number Title Priority Date Filing Date
TW101141104A TW201418992A (en) 2012-11-06 2012-11-06 Data transmission control method and device of serial peripheral interface master device

Country Status (1)

Country Link
TW (1) TW201418992A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI679539B (en) * 2017-10-05 2019-12-11 廣州印芯半導體技術有限公司 Master-slave system, command execution method and data access method
TWI818834B (en) * 2022-12-16 2023-10-11 新唐科技股份有限公司 Microcontroller and serial peripheral interface system using the same

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI679539B (en) * 2017-10-05 2019-12-11 廣州印芯半導體技術有限公司 Master-slave system, command execution method and data access method
US10592448B2 (en) 2017-10-05 2020-03-17 Guangzhou Tyrafos Semiconductor Technologies Co., Ltd Master-slave system, command execution method and data access method with use of serial peripheral interface (SPI)
TWI818834B (en) * 2022-12-16 2023-10-11 新唐科技股份有限公司 Microcontroller and serial peripheral interface system using the same

Similar Documents

Publication Publication Date Title
GB2471791A (en) Data aggregation for drilling operations
JP2017537382A5 (en)
PH12017500531A1 (en) Embedded universal serial bus (usb) debug (eud) for multi-interfaced debugging in electronic systems
MX2014007127A (en) Methods of calibration transfer for a testing instrument.
WO2008085759A3 (en) Multitouch data fusion
GB2509463A (en) Live logical partition migration with stateful offload connections using context extraction and insertion
WO2012044808A3 (en) Method and system for performing drag and drop operations on a device via user gestures
JP2010172014A5 (en)
WO2017160438A1 (en) Distribution of forwarded clock
CN103593527A (en) Design method for one-click setting of different types of routing rule BGAs in PCB
JP2018038726A5 (en)
Guo et al. FPGA implementation of VLC communication technology
TW201418992A (en) Data transmission control method and device of serial peripheral interface master device
US8504973B1 (en) Systems and methods for generating a test environment and test system surrounding a design of an integrated circuit
GB201212131D0 (en) Simulated paper texture using clear toner and glossmark on texture-less stock
FI3000239T3 (en) System and method for universal control of electronic devices
US8868827B2 (en) FIFO apparatus for the boundary of clock trees and method thereof
TW200823624A (en) Glitch-free clock switcher
US8984196B2 (en) Accessing peripheral devices
WO2014106181A3 (en) A method and an apparatus for securely signing application data
Kwok et al. Addressing the challenges of reset verification in SoC designs
JP2020507176A5 (en)
EA201100722A1 (en) METHOD FOR SETTING THE TIME OF DELAYING THE INITIATING DEVICE AND METHOD OF MANAGING THE ELECTRON DETONATOR IN THE SYSTEM OF INITIALIZATION OF THE ELECTRON DETONATOR
US9202006B1 (en) System and method for connecting components in an electronic design
CN106294260B (en) The method that data are output to synchronous bus from asynchronous bus