WO2023197709A1 - Device identification method and related apparatus - Google Patents

Device identification method and related apparatus Download PDF

Info

Publication number
WO2023197709A1
WO2023197709A1 PCT/CN2023/071238 CN2023071238W WO2023197709A1 WO 2023197709 A1 WO2023197709 A1 WO 2023197709A1 CN 2023071238 W CN2023071238 W CN 2023071238W WO 2023197709 A1 WO2023197709 A1 WO 2023197709A1
Authority
WO
WIPO (PCT)
Prior art keywords
slave device
value
model
register
slave
Prior art date
Application number
PCT/CN2023/071238
Other languages
French (fr)
Chinese (zh)
Inventor
段杨森
Original Assignee
荣耀终端有限公司
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 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2023197709A1 publication Critical patent/WO2023197709A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/24Resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of terminal technology, and in particular, to a device identification method and related devices.
  • the serial peripheral interface (SPI) bus system is a synchronous serial peripheral interface that is widely used in products such as integrated circuits and electronic equipment.
  • the processor (CPU) and peripheral devices in the electronic device can communicate in a serial manner through the SPI interface to exchange information, and then obtain information from the peripheral device or control the peripheral device to implement one or more functions of the electronic device. function.
  • Peripheral devices include but are not limited to: touch panels, sensors or displays, etc.
  • inventions of the present application provide a device identification method.
  • This method is applied to electronic equipment.
  • the electronic equipment includes a master device and a slave device.
  • the master device is connected to the slave device through the serial peripheral interface SPI bus.
  • the master device stores a corresponding relationship.
  • the corresponding relationship includes the slave device model, the first address, the first address, and the slave device model.
  • any slave device model corresponds to a first address, a first preset value, a second address and a second preset value. Set value.
  • the device identification method includes: the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first value corresponding to the first slave device model and the second value corresponding to the first slave device model; when the master device Determine that the first value corresponding to the first slave device model is the same as the first preset value corresponding to the first slave device model, and the second value corresponding to the first slave device model is the second preset value corresponding to the first slave device model.
  • the master device configures the slave device based on the first slave device model; before the master device configures the slave device based on the first slave device model, the third value is a fixed value, and the third value is the slave device corresponding to the first slave device model.
  • the second type of address corresponds to the value of the register.
  • the first address may be the address of the identification register
  • the second address may be the address of the review register.
  • the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first value corresponding to the first slave device model and the second value corresponding to the first slave device model, including: master The device reads the value of the register in the slave device based on the first address corresponding to the first slave device model and obtains the first value; the master device reads the value of the register in the slave device based on the second type address corresponding to the first slave device model and obtains Second value.
  • the master device reads the value of the register in the slave device based on the second type address corresponding to the first slave device model, and obtains the second value, including: when the master device determines that the first value corresponds to the first slave device model.
  • the master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model to obtain the second value.
  • the method also includes: when the master device determines that the first value is inconsistent with the first preset value corresponding to the first slave device model, or the master device determines that the second value is inconsistent with the second preset value corresponding to the first slave device model.
  • the master device reads the value of the register in the slave device based on the second slave device model and the corresponding relationship.
  • the model number of the slave device can also be verified based on the second slave device model number.
  • the master device configures the slave device based on the preset model, and the preset model is the one in the corresponding relationship. Any slave device model.
  • the master device may successfully configure the slave device based on the preset model, so that the slave device can operate normally, increasing the possibility that the master device successfully configures the slave device.
  • the adjustment parameters corresponding to the first slave device model are written into the register of the slave device, so that the slave device operates based on the adjustment parameters.
  • the master device before the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, it includes: the master device switches from the second state to the first state, the second state is the power-off state, and the first state is the power-on state; or, the master device detects that the slave device switches from the second state to the first state.
  • the corresponding relationship is stored in the main device in the form of a table.
  • master devices include but are not limited to: processor CPU or system-on-chip SOC, microcontroller MCU, microprocessor MPU or programmable system-on-chip SOPC; slave devices include but are not limited to: sensors, batteries, antennas, mobile devices Communication module, wireless communication module, audio module, speaker, receiver, microphone, headset, button, motor, indicator, camera, display screen, and user identification module.
  • the device identification method can be applied between a variety of master devices and slave devices, and has a wide range of applications.
  • the preset model may be the model corresponding to the most frequently used slave device in the electronic device. This increases the likelihood that the master will successfully configure the slave.
  • the master device verifies the model number of the slave device based on the first type address and/or the second type address multiple times. In this way, misrecognition situations can be further reduced.
  • inventions of the present application provide an electronic device.
  • the electronic device includes a terminal device.
  • the terminal device may be: a mobile phone, a tablet computer, a laptop computer, a personal digital assistant (PDA), or a mobile Internet device (mobile Internet access device).
  • PDA personal digital assistant
  • mobile Internet device mobile Internet access device.
  • internet device MID
  • wearable devices consumer electronics, laptops, desktop computers, automobiles, industrial control robots or industrial electronic equipment, etc.
  • the electronic device includes: a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the method of the first aspect.
  • embodiments of the present application provide a computer-readable storage medium.
  • Computer programs or instructions are stored in the computer-readable storage medium. When the computer programs or instructions are run, the method of the first aspect is implemented.
  • embodiments of the present application provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the method of the first aspect is implemented.
  • Figure 1 is a schematic diagram of the connection between a master device and a slave device provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of an application scenario provided by the embodiment of the present application.
  • Figure 3 is a schematic structural diagram of a slave device provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.
  • Figure 5 is a flow diagram of a device identification method in a possible design
  • Figure 7 is a schematic flowchart of misidentification of a device in a possible design
  • Figure 8 is a schematic flow chart of a device identification method provided by an embodiment of the present application.
  • words such as “first” and “second” are used to distinguish the same or similar items with basically the same functions and effects.
  • the first device and the second device are only used to distinguish different devices, and their sequence is not limited.
  • words such as “first” and “second” do not limit the number and execution order, and words such as “first” and “second” do not limit the number and execution order.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in the implementation of the present application.
  • the implementation of the examples does not constitute any limitations.
  • the SPI bus works in a master-slave mode, and the master device can be connected to one or more slave devices through the SPI bus.
  • the processor can be connected to one or more slave devices in a sensor, a touch panel, a display screen, etc. through an SPI bus.
  • MISO is the master device data input and slave device data output; MISO can also be called SOMI or SDO, etc.
  • MOSI is the master device data output and slave device data input; MOSI can also be called SIMO or SDO, etc.
  • SCLK is the clock signal, generated by the master device; CS is the enable signal of the slave device, controlled by the master device; CS can also be called SS or SSEL, etc. The embodiments of the present application do not limit this.
  • MOMI can also be called SISO.
  • SCLK is the clock signal, generated by the master device;
  • CS is the enable signal of the slave device, controlled by the master device;
  • CS can also be called SS or SSEL, etc. The embodiments of the present application do not limit this.
  • the SPI bus can omit the CS transmission line and connect the pins used to connect the CS transmission line to ground.
  • the master device can be connected to the slave device through a four-wire SPI interface (as shown in a and b in Figure 1), or it can be connected to the slave device through a three-wire SPI interface (as shown in c and d in Figure 1). ).
  • the master device can also connect to one or more slave devices through a set of SPI interfaces (as shown in e and f in Figure 1).
  • a master device when a master device connects to a slave device through a set of SPI interfaces, the master device can selectively enable different slave devices connected to the SPI interface through different CS signals. However, at the same time, only one slave device among the slave devices connected to a group of SPI interfaces is enabled and can be enabled.
  • a set of SPI interfaces can reserve multiple slave device positions to connect multiple slave devices, or can reserve a slave device position to connect one slave device (there may be slave devices of different models but with the same package attached at this position ).
  • the master device needs to configure the SPI interface before configuring the slave device.
  • the type, model, etc. of the connected slave device are identified, and initial configuration is performed based on the type, model, etc. of the slave device.
  • the master device sends inquiries to the slave devices in the order of the pre-stored identification registers.
  • the master device recognizes the slave device. , configure the slave device.
  • Reset refers to the process in which the registers in the device return to their initial state when the device is powered on for the first time or after a power outage. For example, when the electronic device is turned on, both the master device and the slave device may be in an initial state and start working from the initial state.
  • the master device 101 is used to obtain data from the slave device 102 through the SPI bus and/or control the slave device 102, etc., thereby realizing one or more functions of the electronic device. For example, taking the master device as a CPU and the slave device as a temperature sensor, the CPU obtains the temperature detected by the temperature sensor through the SPI bus and executes a temperature processing strategy based on the temperature. The CPU can also adjust the temperature sensor detection frequency through the SPI bus.
  • the master device 101 is compatible with multiple models of slave devices connected through the SPI bus. Different types of slave devices will have differences in their corresponding device principles, internal structures, software implementation, etc. Therefore, after the master device is powered on or the slave device is powered on, the master device needs to identify the model of the slave device to initialize the configuration of the slave device, thereby realizing one or more functions of the electronic device.
  • the master device 101 can read or rewrite the value of the register in the slave device 102 through the SPI bus to realize the identification of the model of the slave device 102, data acquisition and control, etc.
  • the structure of the slave device 102 will be described below with reference to FIG. 3 .
  • Slave device 102 includes multiple registers. Registers include but are not limited to control registers, status registers, function registers and identification registers.
  • Control class registers are used to control and determine the operating mode of the slave device and the working characteristics of the slave device.
  • Status registers are used to store two types of information: one type of information is various status information (condition codes) that reflect the execution results of instructions, such as whether there is a carry (CF bit), whether there is an overflow (OV bit), and whether the result is positive or negative (SF bit), whether the result is zero (ZF bit), parity flag bit (P bit), etc.; another type of information is control information, such as enable interrupt (IF bit), tracking flag (TF bit), etc.
  • condition codes that reflect the execution results of instructions, such as whether there is a carry (CF bit), whether there is an overflow (OV bit), and whether the result is positive or negative (SF bit), whether the result is zero (ZF bit), parity flag bit (P bit), etc.
  • control information such as enable interrupt (IF bit), tracking flag (TF bit), etc.
  • Functional registers are used to store control commands, status or data of corresponding functional components.
  • the identification register is used to store device identification to facilitate the master device to distinguish the type of slave device.
  • each register in the slave device corresponds to an address, and registers corresponding to different addresses have different functions.
  • the slave device includes multiple registers, namely register 01, register 02, register 03, etc.
  • register 01 can be a status register, used to store status information about whether the temperature is abnormal
  • register 02 can be a control register, used to store the detection frequency
  • register 03 can be an identification register, used To store device identification.
  • the slave device shown in Figure 3 can also include a functional register for storing the detected temperature.
  • register 01 in Figure 3 can be an identification register, used to store device identification.
  • Register 02 can be a status register, used to store status information about whether the temperature is abnormal;
  • register 03 can be a control register, used to store the frequency of detection.
  • the embodiments of this application do not limit the specific functions of the registers in the slave device and the addresses of the registers corresponding to each function.
  • the main device 101 may be a processor (central processing unit, CPU), system on chip (SOC), microcontroller (micro control unit, MCU), or microprocessor in an electronic device (MPU) and system-on-a-programmable-chip (SOPC), etc.
  • CPU central processing unit
  • SOC system on chip
  • MCU microcontroller
  • MPU microcontroller
  • SOPC system-on-a-programmable-chip
  • the slave device 102 may be a peripheral device in the electronic device.
  • peripheral devices please refer to the hardware architecture description of the electronic device in Figure 4 below, and will not be described again here.
  • FIG. 4 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, Antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , display screen 194, and subscriber identification module (subscriberidentification module, SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), an image signal processor ( image signal processor (ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be recalled from memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuit (inter-integrated circuit, I2C or IIC) interface, serial peripheral interface (SPI), integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, pulse code modulation (pulse code) modulation (PCM) interface, universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, Subscriber identity module (SIM) interface, and/or universal serial bus (USB) interface, etc.
  • I2C or IIC serial peripheral interface
  • SPI serial peripheral interface
  • I2S integrated circuit built-in audio
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM Subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces.
  • the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .
  • the SPI interface is a high-speed synchronous serial communication bus.
  • processor 110 may include multiple sets of SPI buses.
  • the processor 110 can couple peripheral devices such as the temperature sensor 180J, charger, flash, camera 193, etc. through different SPI bus interfaces.
  • the processor 110 can be coupled to the temperature sensor 180J through the SPI interface, so that the processor 110 and the temperature sensor 180J communicate through the SPI bus interface, so that the electronic device 100 can execute a temperature processing strategy based on the temperature detected by the temperature sensor 180J to implement the temperature adjustment function.
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (displayserial interface, DSI), etc.
  • the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 .
  • the processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationships between the modules illustrated in the embodiments of the present application are schematic illustrations and do not constitute a structural limitation on the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Antennas in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite systems. (global navigation satellite system, GNSS), frequency modulation (FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • Wi-Fi wireless fidelity
  • Bluetooth bluetooth, BT
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, display videos, receive sliding operations, and the like.
  • Display 194 includes a display panel.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the light signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • the ISP may be provided in the camera 193.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the internal memory 121 may include a program storage area and a data storage area.
  • the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
  • the storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.).
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
  • Magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may utilize the magnetic sensor 180D to detect opening and closing of the flip holster.
  • the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of terminal devices and be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light outwardly through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
  • Temperature sensor 180J is used to detect temperature.
  • the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also known as "touch device”.
  • the touch sensor 180K can be disposed on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
  • Bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part.
  • the bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
  • the bone conduction sensor 180M can also be provided in an earphone and combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibrating bone obtained by the bone conduction sensor 180M to implement the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to implement the heart rate detection function.
  • the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the processor reads the device identification (chip id) of the peripheral device through polling to realize the model identification of the peripheral device, and then performs corresponding initialization configuration of the peripheral device.
  • the master device reads the value stored in the corresponding register in the slave device in polling sequence and corresponding relationship.
  • the master device recognizes the slave device.
  • the register corresponding to the slave device of the next type is read based on the polling order until the slave device is identified or the last slave device is polled.
  • polling to the last slave device the slave device is not recognized and the slave device identification fails.
  • FIG. 5 is a schematic flowchart of a possible device identification method in the design. As shown in Figure 5, methods include:
  • the master device reads the value of the register in the slave device based on model order and correspondence.
  • the master device may be compatible with multiple slave device connections through the SPI bus.
  • the master device reads the value of the corresponding register in the slave device according to the preset model order and correspondence to confirm the slave device model.
  • the corresponding relationship is the relationship between the slave device model, the identification (chip id) register address and the preset value.
  • the polling order corresponds to the slave device model.
  • the corresponding relationship can be stored in the main device in the form of a table.
  • the correspondence between the slave device model, identification register address and preset value is as shown in Table 1.
  • the identification register address corresponding to model A is 0 ⁇ 00, that is, the identification register corresponding to model A is the 0 ⁇ 00 register, and the default value is 11. It can be understood that the master device can identify whether the slave device is model A based on the value corresponding to the 0 ⁇ 00 register of the slave device and the preset value. When the master device is based on the value corresponding to the 0 ⁇ 00 register of the slave device and is 11, it identifies the slave device as model A; when the master device is based on the value corresponding to the 0 ⁇ 00 register of the slave device and is not 11, it identifies that the slave device is not model A.
  • the identification register corresponding to model B is 0 ⁇ 01 register, that is, the identification register corresponding to model B is 0 ⁇ 01 register, and the default value is 12. It can be understood that the master device can identify whether the slave device is model B based on the value corresponding to the 0 ⁇ 01 register of the slave device and the preset value. When the master device corresponds to a value of 12 based on the 0 ⁇ 01 register of the slave device, it identifies the slave device as model B; when the master device identifies that the slave device is not a B model based on the value corresponding to the 0 ⁇ 01 register of the slave device is not 12.
  • Adaptable after the master device recognizes the slave device, it initializes the configuration of the slave device.
  • the master device configures a new value in a register in the temperature sensor.
  • the value is used to indicate the frequency at which the temperature sensor collects temperature in the environment.
  • the master device confirms whether polling is completed.
  • the master device executes S401.
  • the master device polls to the last model of slave device, the master device fails to identify the slave device.
  • the identification process is as follows:
  • the master device reads the value of the register in the slave device based on the register address corresponding to model A.
  • the master device reads the identification register corresponding to model A, that is, the 0 ⁇ 00 register.
  • the master device identifies the slave device as model A.
  • the master device initializes the slave device based on the A model.
  • the master device reads the value of the register in the slave device based on the register address corresponding to model B.
  • the master device identifies the slave device as model B.
  • the master device initializes the slave device based on the B model.
  • the master device reads the value of the corresponding register in the slave device based on the identification register address corresponding to the first slave device model; when the value read by the master device is the same as the preset value in the corresponding relationship, the master device recognizes that the slave device is the first slave device. Device model.
  • the master device reads the value of the corresponding register in the slave device based on the identification register address corresponding to the next model until the slave device is identified or the last slave device is polled. . When polling to the last model of slave device, the master device did not recognize the slave device and the slave device recognition failed.
  • the master device may make errors when identifying the slave device, resulting in the slave device being unusable, the corresponding functions of the electronic device being unusable, and the user experience being poor.
  • the master device may recognize the model B slave device as the model A slave device. Specifically, when the master device reads the value of the register in the slave device based on the register address corresponding to the A model, the value corresponding to the corresponding register in the B model slave device is the same as the preset value corresponding to the A model.
  • the register list corresponding to the two models in the slave device is given as an example.
  • registers in the slave device are reserved registers, which can be understood as undisclosed registers. Reserved registers may be registers that are only used for debugging during the device design and development phase; they may also be registers that have functions in the device design, but the corresponding functions cannot be realized due to production process and other issues.
  • the value corresponding to the reserved register may be a fixed value, a random value, or multiple fixed values.
  • the identification process includes:
  • the master device reads the value of the register in the slave device based on the register address corresponding to model A.
  • the master device reads the identification register corresponding to model A, that is, the 0 ⁇ 00 register.
  • the master device identifies the slave device as model A.
  • the master device is initialized based on the A model.
  • the 0 ⁇ 00 register is a reserved register, and its corresponding value may also be 11. Therefore, the value fed back by the slave device is 11, which is the same as the preset value corresponding to model A.
  • the master device The slave device is misidentified as model A.
  • the master device When the master device performs initial configuration based on model A, it may cause the slave device to initialize configuration errors, and then the slave device cannot operate normally and the corresponding functions fail.
  • embodiments of the present application provide a device identification method.
  • the master device can read the values of two different registers in the slave device and obtain the corresponding two values for verification. When the two values are in line with expectations, the device Recognition successful. In this way, secondary recognition is performed to reduce the situation where the device misrecognizes the initialization configuration and fails due to the same value corresponding to the same address register in different models of slave devices, and optimizes the user experience.
  • the hardware structure of the electronic equipment is not changed, which is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
  • Figure 8 is a schematic flowchart of a slave device identification method provided by an embodiment of the present application. As shown in Figure 8, the method includes:
  • the master device When the electronic device is powered on and initialized, the master device reads the value of the register in the slave device based on the slave device model order and correspondence relationship, and obtains the first value and/or the second value; the correspondence relationship includes the slave device model, first address, The relationship between the first preset value, the second address and the second preset value.
  • the master device switches from the power-off state to the power-on state and begins to identify the slave device.
  • the first address may be the address corresponding to the identification register corresponding to the slave device of different models
  • the second address may be the address corresponding to the review register corresponding to the slave devices of different models.
  • the identification register is a register that stores device identification and is used to distinguish device models.
  • Review Register A register used to verify the device model.
  • the identification register address corresponding to model A is 0 ⁇ 00, and the first preset value is 11; the review register address corresponding to model A is 0 ⁇ 01, and the first preset value is 0 ⁇ 01.
  • the default value is 12.
  • the identification register address corresponding to model B is 0 ⁇ 01 register, and the first preset value is 12; the review register address corresponding to model B is 0 ⁇ 02, and the second preset value is 14.
  • one of the multiple registers in the slave device can be identified by the address, and the address can also be understood as a register number.
  • the above correspondence relationship can be stored in the main device in the form of a table. Illustrative, as shown in Table 3.
  • the master device reads the value of the register in the slave device based on the first address and the second address, and obtains the first value and the second value.
  • the master device may first read the value of the register in the slave device based on the first address to obtain the first value; it may also first read the value of the register in the slave device based on the second address to obtain the second value.
  • the second addresses corresponding to the slave devices of different models may be the same or different, which is not limited in the embodiment of the present application.
  • the master device is compatible with multiple slave device connections through the SPI bus.
  • the master device reads the value of the corresponding register in the slave device according to the preset model order and correspondence to confirm the slave device model.
  • the master device recognizes the slave device and initializes the slave device based on the model.
  • the second value master device configures The slave device was previously a fixed value.
  • the master device confirms whether polling is completed.
  • the master device confirms whether polling is completed based on model order. When the master device does not read the value of the register in the slave device based on the last model and corresponding relationship, the polling is not completed, and the master device executes S701 until the slave device is recognized or the polling is completed. When the master device reads the value of the register in the slave device based on the last model and corresponding relationship, polling is completed and the master device fails to identify the slave device.
  • the master device when the master device fails to identify the slave device, it configures the slave device based on the preset model.
  • the master device controls the slave device to reset before reading the value of the register in the slave device based on model order and correspondence to obtain the second value.
  • the master device verifies by reading the values of two different registers in the slave device. In this way, the probability that the same address register in different models of slave devices corresponds to the same value is reduced, and the misidentification of the device is reduced. In addition, the hardware structure of the electronic equipment is not changed, which is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
  • the master device reads the value of the register in the slave device based on the identification register address corresponding to model A, and obtains the first value corresponding to model A.
  • the master device is connected to multiple slave devices through the SPI bus.
  • the master device confirms the model of the slave device through polling according to the preset polling order and corresponding relationship.
  • the corresponding relationship is the relationship between the slave device model, the identification register address, the first preset value, the review register address and the second preset value.
  • the polling order corresponds to the slave device model.
  • the corresponding relationship can be stored in the main device in the form of a table.
  • the corresponding relationship between the slave device model, the identification register address, the first preset value, the review register address, and the second preset value can be as shown in Table 3 above.
  • the identification register address corresponding to model A is 0 ⁇ 00, and the first preset value is 11; the review register address corresponding to model A is 0 ⁇ 01, and the second preset value is 12.
  • the identification register address corresponding to model B is 0 ⁇ 01 register, and the first preset value is 12; the review register address corresponding to model B is 0 ⁇ 02, and the second preset value is 14.
  • the slave device when the master device reads the value of the 0 ⁇ 00 register of the slave device and obtains the first value of 11, and the master device reads the value of the 0 ⁇ 01 register of the slave device and obtains the second value of 13,
  • the slave device is model A.
  • the master device reads the value of the 0 ⁇ 01 register of the slave device and the first value obtained is 12, and the master device reads the value of the 0 ⁇ 02 register of the slave device and obtains the second value 14, the slave device is model B. .
  • the double check register is different from the identification register.
  • the address corresponding to the double check register is different from the address corresponding to the identification register.
  • the addresses of the review registers corresponding to the slave devices of different models may be the same or different, which is not limited in the embodiment of the present application.
  • the addresses of the review registers corresponding to different models of slave devices are the same, but the corresponding second preset values are different.
  • the address of the review register is the same, and the master device can distinguish different models of slave devices by reading the register once.
  • the risk of misidentification can be reduced.
  • the double check register may be a stable register after power-on or an unstable register.
  • unstable registers can be reserved registers, registers whose values have been modified, etc.
  • the register may be a register for data output, a register for indicating mode switching, a register for indicating abnormal conditions, etc.
  • the unstable register may be: a register used to store the detected temperature, an undisclosed retention register, etc.
  • Stable registers can be: registers whose values have not been modified, such as control registers that have a fixed value and have not been read or written during the use of the slave device.
  • the stable register can be: interrupt control register.
  • the reported value of this register is fixed and non-zero after power-on reset.
  • This interrupt control register is used to control the enablement of the interrupt function. The processor is not operating. Through the interrupt control register, it can be predicted that the register value of this register will be fixed after the temperature sensor is powered on and stabilized.
  • the double check register is a register that is stable after power-on. In this way, the identification failure caused by the value in the register being changed can be reduced and the success rate of identification can be improved.
  • the review register is a non-zero register. It is understandable that most registers report a value of 0 after power-on reset, and the value of a register is usually 0 when an exception occurs. In this way, selecting a non-zero register can further reduce misidentification and improve the stability of the embodiment of the present application.
  • the review register is a register whose reported value is fixed and non-zero after power-on. In this way, the identification failure caused by the value in the register being changed can be reduced and the success rate of identification can be improved.
  • the master device reads the value of the register in the slave device based on the review register address corresponding to model A, and obtains the second value corresponding to model A.
  • the master device identifies the slave device as model A.
  • the master device configures the slave device based on the A model.
  • the master device confirms whether polling is completed.
  • the master device reads the value of the register in the slave device based on the identification register address corresponding to model B, and obtains the first value corresponding to model B.
  • the method also includes S805. S805. Before the master device reads the value of the register in the slave device based on the review register address, the master device controls the slave device to reset.
  • the values corresponding to some registers in the slave device may change.
  • the register used to store the detected temperature may be rewritten multiple times to store the latest detected temperature. Taking the default value as 20 and the detected temperature as less than 30 as an example, the corresponding value of the register used to store the detected temperature may be rewritten from 20 to 30.
  • resetting the slave device will restore the value of the register in the slave device to the default value, which can reduce recognition failure or misrecognition caused by the value corresponding to the review register being overwritten.
  • the method also includes S806. S806.
  • the master device fails to identify the slave device, configure the slave device based on the preset model. In this way, the master device may successfully configure the slave device based on the preset model, so that the slave device can operate normally, thereby realizing the functions of the electronic device.
  • the preset model may be a model corresponding to the most frequently used slave device in the electronic device. This increases the likelihood that the master will successfully configure the slave.
  • the master device may verify the model number of the slave device based on the identification register address and/or the review register address multiple times. In this way, misrecognition situations are further reduced.
  • the SPI interface compatible with slave devices of model A and model B in the process shown in Figure 9 is only an example. In actual applications, the SPI interface can also be compatible with more models of slave devices. The embodiment of this application is for SPI The model and type of interface-compatible slave devices are not limited.
  • the slave devices compatible with the SPI interface may be slave devices of different models of the same type, or may be slave devices of different types.
  • the embodiments of the present application do not limit this.
  • the master device switches from the power-off state to the power-on state, and the master device needs to identify and configure the slave device.
  • the slave device switches from the power-down state to the power-on state, the master device also needs to identify and configure the slave device.
  • the method provided by the embodiment of the present application can also be applied when the slave device switches from the power-off state to the power-on state, and can also be applied during the process of powering on the slave device after powering off.
  • a problem occurs in the software system of the electronic device, causing the slave device to be powered off and then powered on, or a slave device may latch up (lanch-up), causing the slave device to be powered off and then powered on.
  • the device identification method of the embodiment of the present application has been described above.
  • the following describes the relevant device provided by the embodiment of the present application for performing the above device identification method.
  • Those skilled in the art can understand that methods and devices can be combined and referenced with each other, and the relevant devices provided in the embodiments of the present application can perform the steps in the device identification method described above.
  • the computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or may be targeted to carry any other medium or medium that stores the required program code in the form of instructions or data structures and accessible by a computer.
  • any connection is properly termed a computer-readable medium.
  • coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave
  • coaxial Cables, fiber optic cables, twisted pairs, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium.

Abstract

Provided in the embodiments of the present application are a device identification method and a related apparatus, which are applied to an electronic device. The electronic device comprises a master device, which stores a correspondence, and a slave device, which is connected to the master device by means of an SPI bus, wherein the correspondence comprises the relationship among a slave device model number, a first address, a first preset value, a second address and a second preset value. The method comprises: on the basis of the model number of a slave device model number and a correspondence, a master device reading values of registers in a slave device, so as to obtain a first value and a second value, which correspond to the model number of a first slave device; and if the first value and the second value are respectively the same as a first preset value and a second preset value, which correspond to the model number of the first slave device, the master device configuring the slave device on the basis of the model number of the first slave device. Before the master device configures the slave device, the value of a register corresponding to a second address which corresponds to the model number of the first slave device in the slave device is a constant value. Two instances of verification and identification are performed on the basis of two addresses, such that misidentification of the model number of a device that is caused by the same value of registers of the same address is reduced, thus reducing configuration failures.

Description

器件识别方法和相关装置Device identification method and related device
本申请要求于2022年04月12日提交中国国家知识产权局、申请号为202210380036.1、申请名称为“器件识别方法和相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application submitted to the State Intellectual Property Office of China on April 12, 2022, with application number 202210380036.1 and application title "Device Identification Method and Related Devices", the entire content of which is incorporated into this application by reference. middle.
技术领域Technical field
本申请涉及终端技术领域,尤其涉及一种器件识别方法和相关装置。The present application relates to the field of terminal technology, and in particular, to a device identification method and related devices.
背景技术Background technique
串行外设接口(serial peripheral interface,SPI)总线系统是一种同步串行外设接口,广泛使用于集成电路和电子设备等产品中。示例性的,电子设备中的处理器(CPU)与外围器件可以通过SPI接口以串行方式进行通信以交换信息,进而从外围器件获取信息或控制外围器件,以实现电子设备的一种或多种功能。外围器件包括但不限于:触控面板、传感器或显示屏等。The serial peripheral interface (SPI) bus system is a synchronous serial peripheral interface that is widely used in products such as integrated circuits and electronic equipment. For example, the processor (CPU) and peripheral devices in the electronic device can communicate in a serial manner through the SPI interface to exchange information, and then obtain information from the peripheral device or control the peripheral device to implement one or more functions of the electronic device. function. Peripheral devices include but are not limited to: touch panels, sensors or displays, etc.
目前,在电子设备中处理器(CPU)通过一组SPI接口可以兼容连接多个型号的外围器件,以提高SPI接口的复用率。因此,处理器需要识别通过SPI接口连接的外围器件的型号,进而基于型号进行相应的初始化配置。Currently, in electronic equipment, the processor (CPU) can be compatible with multiple types of peripheral devices through a set of SPI interfaces to improve the reuse rate of the SPI interface. Therefore, the processor needs to identify the model of the peripheral device connected through the SPI interface, and then perform corresponding initialization configuration based on the model.
但是,在识别过程中,可能会出现误识别,导致从器件初始化配置有误,外围器件无法使用,恶化用户体验。However, during the recognition process, misrecognition may occur, resulting in incorrect initial configuration of the slave device, making peripheral devices unusable, and worsening the user experience.
发明内容Contents of the invention
本申请实施例提供一种器件识别方法和相关装置,主器件可以基于标识寄存器地址及一个额外的寄存器地址读取从器件中两个不同的寄存器的数值,得到对应的两个值进行验证。当两次的值均符合预期时,器件识别成功。这样,进行二次识别,减少因不同型号从器件中的相同地址的寄存器对应的值相同,导致器件型号误识别,进而初始化配置从器件失败的情况,优化用户体验。此外,本申请实施例未改动电子设备的硬件结构,成本友好,提高系统设计灵活性,提高产品物料供应的稳定性。Embodiments of the present application provide a device identification method and related devices. The master device can read the values of two different registers in the slave device based on the identification register address and an additional register address, and obtain the corresponding two values for verification. When both values are as expected, the device identification is successful. In this way, secondary identification is performed to reduce the misidentification of device models due to registers with the same address in different models of slave devices having the same value, resulting in failure to initialize and configure the slave device, and to optimize the user experience. In addition, the embodiment of the present application does not change the hardware structure of the electronic device, is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
第一方面,本申请实施例提供一种器件识别方法。该方法应用于电子设备,电子设备包括主器件和从器件,主器件通过串行外设接口SPI总线与从器件连接,主器件存储有对应关系,对应关系包括从器件型号、第一地址、第一预设值、第二地址和第二预设值之间的关系,对应关系中任一从器件型号对应有一个第一地址、一个第一预设值、一个第二地址和一个第二预设值。In a first aspect, embodiments of the present application provide a device identification method. This method is applied to electronic equipment. The electronic equipment includes a master device and a slave device. The master device is connected to the slave device through the serial peripheral interface SPI bus. The master device stores a corresponding relationship. The corresponding relationship includes the slave device model, the first address, the first address, and the slave device model. The relationship between a preset value, a second address and a second preset value. In the corresponding relationship, any slave device model corresponds to a first address, a first preset value, a second address and a second preset value. Set value.
器件识别方法包括:主器件基于第一从器件型号和对应关系读取从器件中寄存器的数值,得到第一从器件型号对应的第一值和第一从器件型号对应的第二值;当主器件确定第一从器件型号对应的第一值与第一从器件型号对应的第一预设值相同,并且第一从器件型号对应的第二值与第一从器件型号对应的第二预设值相同时,主器件基 于第一从器件型号配置从器件;在主器件基于第一从器件型号配置从器件之前,第三值为固定值,第三值为从器件中与第一从器件型号对应的第二类地址对应的寄存器的值寄存器的数值。The device identification method includes: the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first value corresponding to the first slave device model and the second value corresponding to the first slave device model; when the master device Determine that the first value corresponding to the first slave device model is the same as the first preset value corresponding to the first slave device model, and the second value corresponding to the first slave device model is the second preset value corresponding to the first slave device model. At the same time, the master device configures the slave device based on the first slave device model; before the master device configures the slave device based on the first slave device model, the third value is a fixed value, and the third value is the slave device corresponding to the first slave device model. The second type of address corresponds to the value of the register.
第一地址可以为标识寄存器的地址,第二地址可以为复查寄存器的地址。这样,基于两个寄存器地址进行两次验证识别,可以减少因不同型号从器件中的相同地址的寄存器对应的值相同导致的器件型号误识别,减少从器件配置失败的情况,优化用户体验。此外,本申请实施例未改动电子设备的硬件结构,成本友好,提高系统设计灵活性,提高产品物料供应的稳定性。The first address may be the address of the identification register, and the second address may be the address of the review register. In this way, two verification and identification based on two register addresses can reduce device model misidentification caused by the same value corresponding to the register of the same address in different models of slave devices, reduce the failure of slave device configuration, and optimize the user experience. In addition, the embodiment of the present application does not change the hardware structure of the electronic device, is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
可选的,主器件基于第一从器件型号和对应关系读取从器件中寄存器的数值,得到第一从器件型号对应的第一值和第一从器件型号对应的第二值,包括:主器件基于第一从器件型号对应的第一地址读取从器件中寄存器的数值,得到第一值;主器件基于第一从器件型号对应的第二类地址读取从器件中寄存器的数值,得到第二值。Optionally, the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first value corresponding to the first slave device model and the second value corresponding to the first slave device model, including: master The device reads the value of the register in the slave device based on the first address corresponding to the first slave device model and obtains the first value; the master device reads the value of the register in the slave device based on the second type address corresponding to the first slave device model and obtains Second value.
可选的,主器件基于第一从器件型号对应的第二类地址读取从器件中寄存器的数值,得到第二值,包括:当主器件确定第一值与第一从器件型号对应的第一预设值相同时,主器件基于第一从器件型号对应的第二地址读取从器件中寄存器的数值,得到第二值。Optionally, the master device reads the value of the register in the slave device based on the second type address corresponding to the first slave device model, and obtains the second value, including: when the master device determines that the first value corresponds to the first slave device model. When the preset values are the same, the master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model to obtain the second value.
在第一值与第一预设值相同时,主器件读取得到第二值。这样,第一值与第一预设值不同时,无需对第二值进行判断,节约计算资源。When the first value is the same as the first preset value, the master device reads the second value. In this way, when the first value is different from the first preset value, there is no need to judge the second value, thereby saving computing resources.
可选的,方法还包括:当主器件确定第一值与第一从器件型号对应的第一预设值不一致,或者主器件确定第二值与第一从器件型号对应的第二预设值不一致时,主器件基于第二从器件型号和对应关系读取从器件中寄存器的数值。Optionally, the method also includes: when the master device determines that the first value is inconsistent with the first preset value corresponding to the first slave device model, or the master device determines that the second value is inconsistent with the second preset value corresponding to the first slave device model. When , the master device reads the value of the register in the slave device based on the second slave device model and the corresponding relationship.
这样,还可以基于第二从器件型号验证从器件的型号。In this way, the model number of the slave device can also be verified based on the second slave device model number.
可选的,当第二从器件型号为对应关系中最后一个型号且主器件未识别到从器件为第二从器件型号时,主器件基于预设型号配置从器件,预设型号为对应关系中任意一个从器件型号。Optionally, when the second slave device model is the last model in the corresponding relationship and the master device does not recognize that the slave device is the second slave device model, the master device configures the slave device based on the preset model, and the preset model is the one in the corresponding relationship. Any slave device model.
这样,主器件可能会基于预设型号成功配置从器件,使得从器件可以正常运行,提高主器件成功配置从器件的可能性。In this way, the master device may successfully configure the slave device based on the preset model, so that the slave device can operate normally, increasing the possibility that the master device successfully configures the slave device.
可选的,主器件基于第一从器件型号配置从器件,包括:主器件将第一从器件型号对应的调整参数写入从器件的寄存器中。Optionally, the master device configures the slave device based on the first slave device model, including: the master device writes the adjustment parameters corresponding to the first slave device model into a register of the slave device.
这样,将第一从器件型号对应的调整参数写入从器件的寄存器中,使得从器件基于调整参数运行。In this way, the adjustment parameters corresponding to the first slave device model are written into the register of the slave device, so that the slave device operates based on the adjustment parameters.
可选的,在主器件基于第一从器件型号对应的第二地址读取从器件中寄存器的数值之前,还包括:主器件控制从器件复位。Optionally, before the master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model, the method further includes: the master device controls the slave device to reset.
这样,将从器件复位将从器件中寄存器的数值恢复至默认值,可以减少复查寄存器对应的值被改写等情况导致的识别失败或者误识别。In this way, resetting the slave device will restore the value of the register in the slave device to the default value, which can reduce recognition failure or misrecognition caused by the value corresponding to the review register being overwritten.
可选的,固定值不为零。Optional, fixed value not zero.
可以理解的是,多数寄存器上电复位后寄存器报值为0,以及寄存器异常时报值通常为0。这样,选择非零寄存器可以进一步减少误识别,提高本申请实施例稳定性。It is understandable that most registers report a value of 0 after power-on reset, and the value of a register is usually 0 when an exception occurs. In this way, selecting a non-zero register can further reduce misidentification and improve the stability of the embodiment of the present application.
可选的,第二类地址对应的寄存器包括:读值固定且未被读写操作过的控制寄存 器。Optionally, the registers corresponding to the second type of address include: control registers with fixed reading values that have not been read or written.
这样,可以减少寄存器中的值被改变导致的识别失败的情况,提高识别的成功率。In this way, the identification failure caused by the value in the register being changed can be reduced and the success rate of identification can be improved.
可选的,主器件基于第一从器件型号和对应关系读取从器件中寄存器的数值之前,包括:主器件从第二状态切换为第一状态,第二状态为下电状态,第一状态为上电状态;或者,主器件检测到从器件从第二状态切换为第一状态。Optionally, before the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, it includes: the master device switches from the second state to the first state, the second state is the power-off state, and the first state is the power-on state; or, the master device detects that the slave device switches from the second state to the first state.
可选的,对应关系以表格的形式存储在主器件中。Optionally, the corresponding relationship is stored in the main device in the form of a table.
可选的,主器件包括但不限于:处理器CPU或系统级芯片SOC、微控制器MCU、微处理器MPU或可编程片上系统SOPC;从器件包括但不限于:传感器、电池、天线、移动通信模块,无线通信模块,音频模块、扬声器、受话器、麦克风、耳机、按键、马达、指示器、摄像头、显示屏,以及用户标识模块。Optionally, master devices include but are not limited to: processor CPU or system-on-chip SOC, microcontroller MCU, microprocessor MPU or programmable system-on-chip SOPC; slave devices include but are not limited to: sensors, batteries, antennas, mobile devices Communication module, wireless communication module, audio module, speaker, receiver, microphone, headset, button, motor, indicator, camera, display screen, and user identification module.
器件识别方法可以适用于多种主器件和从器件之间,适用范围广。The device identification method can be applied between a variety of master devices and slave devices, and has a wide range of applications.
可选的,预设型号可以为电子设备中使用次数最多从器件对应的型号。这样,提高主器件成功配置从器件的可能性。Optionally, the preset model may be the model corresponding to the most frequently used slave device in the electronic device. This increases the likelihood that the master will successfully configure the slave.
可选的,主器件多次基于第一类地址和/或第二类地址对从器件的型号进行验证。这样,可以进一步减少误识别情况。Optionally, the master device verifies the model number of the slave device based on the first type address and/or the second type address multiple times. In this way, misrecognition situations can be further reduced.
第二方面,本申请实施例提供一种电子设备,电子设备包括终端设备,终端设备可以为:手机、平板电脑、膝上型电脑、个人数字助理(personal digitalassistant,PDA)、移动上网装置(mobile internet device,MID)、可穿戴式设备、消费电子产品、笔记本电脑、台式电脑、汽车、工业控制机器人或工业电子装备等。In a second aspect, embodiments of the present application provide an electronic device. The electronic device includes a terminal device. The terminal device may be: a mobile phone, a tablet computer, a laptop computer, a personal digital assistant (PDA), or a mobile Internet device (mobile Internet access device). internet device (MID), wearable devices, consumer electronics, laptops, desktop computers, automobiles, industrial control robots or industrial electronic equipment, etc.
电子设备包括:处理器和存储器;存储器存储计算机执行指令;处理器执行存储器存储的计算机执行指令,使得处理器执行上述第一方面的方法。The electronic device includes: a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the method of the first aspect.
上述第二方面以及上述第二方面的各可能的设计中所提供的电子设备,其有益效果可以参见上述第一方面和第一方面的各可能的结构所带来的有益效果,在此不再赘述。The beneficial effects of the electronic equipment provided in the above-mentioned second aspect and the possible designs of the above-mentioned second aspect can be referred to the beneficial effects brought by the above-mentioned first aspect and the possible structures of the first aspect, and will not be discussed here. Repeat.
第三方面,本申请实施例提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序或指令,当计算机程序或指令被运行时,实现上述第一方面的方法。In a third aspect, embodiments of the present application provide a computer-readable storage medium. Computer programs or instructions are stored in the computer-readable storage medium. When the computer programs or instructions are run, the method of the first aspect is implemented.
上述第三方面以及上述第三方面的各可能的设计中所提供的计算机可读存储介质,其有益效果可以参见上述第一方面和第一方面的各可能的结构所带来的有益效果,在此不再赘述。The beneficial effects of the computer-readable storage medium provided in the above-mentioned third aspect and the possible designs of the above-mentioned third aspect can be seen in the beneficial effects brought by the above-mentioned first aspect and the possible structures of the first aspect. This will not be described again.
第四方面,本申请实施例提供一种计算机程序产品,包括计算机程序或指令,计算机程序或指令被处理器执行时,实现上述第一方面的方法。In a fourth aspect, embodiments of the present application provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the method of the first aspect is implemented.
上述第四方面以及上述第四方面的各可能的设计中所提供的计算机程序产品,其有益效果可以参见上述第一方面和第一方面的各可能的结构所带来的有益效果,在此不再赘述。The beneficial effects of the computer program product provided in the above-mentioned fourth aspect and possible designs of the above-mentioned fourth aspect can be referred to the beneficial effects brought about by the above-mentioned first aspect and various possible structures of the first aspect, which are not discussed here. Again.
附图说明Description of the drawings
图1为本申请实施例提供的一种主器件和从器件连接示意图;Figure 1 is a schematic diagram of the connection between a master device and a slave device provided by an embodiment of the present application;
图2为本申请实施例提供的一种应用场景示意图;Figure 2 is a schematic diagram of an application scenario provided by the embodiment of the present application;
图3为本申请实施例提供的一种从器件结构示意图;Figure 3 is a schematic structural diagram of a slave device provided by an embodiment of the present application;
图4为本申请实施例提供的一种电子设备的硬件结构示意图;Figure 4 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;
图5为可能的设计中一种器件识别方法的流程示意图;Figure 5 is a flow diagram of a device identification method in a possible design;
图6为可能的设计中一种器件识别方法的流程示意图;Figure 6 is a flow diagram of a device identification method in a possible design;
图7为可能的设计中一种器件误识别的流程示意图;Figure 7 is a schematic flowchart of misidentification of a device in a possible design;
图8为本申请实施例提供的一种器件识别方法的流程示意图;Figure 8 is a schematic flow chart of a device identification method provided by an embodiment of the present application;
图9为本申请实施例提供的一种器件识别方法的流程示意图。Figure 9 is a schematic flowchart of a device identification method provided by an embodiment of the present application.
具体实施方式Detailed ways
为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。例如,第一设备和第二设备仅仅是为了区分不同的设备,并不对其先后顺序进行限定。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。In order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as “first” and “second” are used to distinguish the same or similar items with basically the same functions and effects. For example, the first device and the second device are only used to distinguish different devices, and their sequence is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the number and execution order, and words such as "first" and "second" do not limit the number and execution order.
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that in this application, words such as “exemplary” or “for example” are used to represent examples, illustrations or explanations. Any embodiment or design described herein as "exemplary" or "such as" is not intended to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words "exemplary" or "such as" is intended to present the concept in a concrete manner.
需要说明的是,本申请实施例描述的网络架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。It should be noted that the network architecture and business scenarios described in the embodiments of this application are for the purpose of more clearly explaining the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art It can be seen that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
可以理解的是,本文中的术语“多个”是指两个或两个以上。本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系;在公式中,字符“/”,表示前后关联对象是一种“相除”的关系。It can be understood that the term "plurality" in this article refers to two or more than two. The term "and/or" in this article is just an association relationship that describes related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations. In addition, the character "/" in this article generally indicates that the related objects before and after are an "or" relationship; in the formula, the character "/" indicates that the related objects before and after are a "division" relationship.
可以理解的是,在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。It can be understood that the various numerical numbers involved in the embodiments of the present application are only for convenience of description and are not used to limit the scope of the embodiments of the present application.
可以理解的是,在本申请的实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。It can be understood that in the embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its functions and internal logic, and should not be used in the implementation of the present application. The implementation of the examples does not constitute any limitations.
为了便于理解,示例的给出部分与本申请实施例相关概念的说明以供参考。To facilitate understanding, the examples given are descriptions of concepts related to the embodiments of the present application for reference.
1、SPI总线:一种高速的全双工同步串行通信接口,SPI总线可以使处理器与各种外围器件以串行方式进行通信以交换数据。数据传输速度比其他串行接口,例如异步数据收发接口(universal asynchronous receiver/transmitter,UART)或者内部集成电路(inter-integrated circuit,I2C)总线要快,可以达到10兆比特每秒(megabits per second,Mbps)左右。1. SPI bus: A high-speed, full-duplex synchronous serial communication interface. The SPI bus allows the processor to communicate with various peripheral devices in a serial manner to exchange data. The data transmission speed is faster than other serial interfaces, such as asynchronous data receiving and receiving interface (universal asynchronous receiver/transmitter, UART) or inter-integrated circuit (inter-integrated circuit, I2C) bus, which can reach 10 megabits per second (megabits per second) , Mbps) or so.
SPI总线以主从方式工作,主器件可以通过SPI总线与一个或多个从器件连接。示例性的,处理器可以通过SPI总线与传感器、触控面板、显示屏等中的一个或多个 从器件连接。The SPI bus works in a master-slave mode, and the master device can be connected to one or more slave devices through the SPI bus. For example, the processor can be connected to one or more slave devices in a sensor, a touch panel, a display screen, etc. through an SPI bus.
需要说明的是,主器件和从器件在通过SPI总线进行通信的过程中,主器件和从器件之间没有应答机制。具体的,使能状态的从器件在接收到来自主器件的请求后,向主器件传输信息;从器件不会向主器件反馈用于指示接收到请求的消息。It should be noted that during the communication process between the master device and the slave device through the SPI bus, there is no response mechanism between the master device and the slave device. Specifically, after receiving a request from the master device, the slave device in the enabled state transmits information to the master device; the slave device will not feedback a message to the master device indicating receipt of the request.
可能的设计一中,SPI总线包括4种传输线,分别为串行时钟线(serial clock,SCLK)、主机输入/从机输出数据线(master in/slave out,MISO)、主机输出/从机输入数据线(master out/slave in,MOSI)、低电平有效从机选择线(chip select,CS)。In possible design one, the SPI bus includes 4 types of transmission lines, namely serial clock line (SCLK), master input/slave output data line (master in/slave out, MISO), master output/slave input Data line (master out/slave in, MOSI), low-level active slave select line (chip select, CS).
MISO为主器件数据输入,从器件数据输出;MISO也可以称为SOMI或SDO等。MOSI为主器件数据输出,从器件数据输入;MOSI也可以称为SIMO或SDO等。SCLK是时钟信号,由主器件产生;CS是从器件的使能信号,由主器件控制;CS也可以称为SS或SSEL等。本申请实施例对此不做限定。MISO is the master device data input and slave device data output; MISO can also be called SOMI or SDO, etc. MOSI is the master device data output and slave device data input; MOSI can also be called SIMO or SDO, etc. SCLK is the clock signal, generated by the master device; CS is the enable signal of the slave device, controlled by the master device; CS can also be called SS or SSEL, etc. The embodiments of the present application do not limit this.
可能的设计二中,SPI总线包括3种传输线,分别为串行时钟线(serial clock,SCLK)、主机输出/主机输入数据线(master output/master input,MOMI)、低电平有效从机选择线(chip select,CS)。In possible design 2, the SPI bus includes three types of transmission lines, namely serial clock line (SCLK), host output/master input data line (master output/master input, MOMI), and low-level active slave selection. Line (chip select, CS).
MOMI也可以称为SISO。SCLK是时钟信号,由主器件产生;CS是从器件的使能信号,由主器件控制;CS也可以称为SS或SSEL等。本申请实施例对此不做限定。MOMI can also be called SISO. SCLK is the clock signal, generated by the master device; CS is the enable signal of the slave device, controlled by the master device; CS can also be called SS or SSEL, etc. The embodiments of the present application do not limit this.
可以理解的是,上述两种可能的设计中,SPI总线可以省去CS传输线,将用于连接CS传输线的管脚接地。It can be understood that among the above two possible designs, the SPI bus can omit the CS transmission line and connect the pins used to connect the CS transmission line to ground.
本申请实施例中,主器件可以通过四线SPI接口连接从器件(如图1中的a和b所示),也可以通过三线SPI接口连接从器件(如图1中的c和d所示)。本申请实施例中,主器件还可以通过一组SPI接口连接一个或多个从器件(如图1中的e和f所示)。In the embodiment of the present application, the master device can be connected to the slave device through a four-wire SPI interface (as shown in a and b in Figure 1), or it can be connected to the slave device through a three-wire SPI interface (as shown in c and d in Figure 1). ). In this embodiment of the present application, the master device can also connect to one or more slave devices through a set of SPI interfaces (as shown in e and f in Figure 1).
需要说明的是,主器件通过一组SPI接口连接从器件时,主器件可以通过不同的CS信号选择性使能SPI接口连接的不同从器件。但是,同一时间中一组SPI接口对应连接的从器件中只有一个从器件处于使能状态,可以被启用。It should be noted that when a master device connects to a slave device through a set of SPI interfaces, the master device can selectively enable different slave devices connected to the SPI interface through different CS signals. However, at the same time, only one slave device among the slave devices connected to a group of SPI interfaces is enabled and can be enabled.
可以理解的是,一组SPI接口可以预留多个从器件位置连接多个从器件,也可以预留一个从器件位置连接一个从器件(可能有不同型号但封装相同的从器件贴在该位置)。It is understandable that a set of SPI interfaces can reserve multiple slave device positions to connect multiple slave devices, or can reserve a slave device position to connect one slave device (there may be slave devices of different models but with the same package attached at this position ).
需要说明的是,主器件可以通过SPI接口兼容相同类型不同型号的从器件连接,也可以兼容不同类型的从器件连接。这样,可以提高产品物料的可供应性,提高接口复用率。It should be noted that the master device can be compatible with the same type of slave devices of different types through the SPI interface, and can also be compatible with the connection of different types of slave devices. In this way, the availability of product materials can be improved and the interface reuse rate can be improved.
可以理解的是,由于不同型号的器件中器件原理、内部结构、软件实现等方面会有差异,当SPI接口可以兼容多个从器件连接时,主器件在对从器件进行配置前需要对SPI接口连接的从器件的类型、型号等进行识别,基于从器件的类型、型号等进行初始化配置。It is understandable that due to differences in device principles, internal structures, software implementation, etc. in different types of devices, when the SPI interface can be compatible with multiple slave device connections, the master device needs to configure the SPI interface before configuring the slave device. The type, model, etc. of the connected slave device are identified, and initial configuration is performed based on the type, model, etc. of the slave device.
2、轮询(polling):是一种主器件决策如何提供从器件服务的方式。具体的,由主器件发出询问,按照从器件可能的型号识别从器件;若主器件基于第一从器件型号识别到从器件,则基于第一从器件型号进行初始化配置;若未基于第一从器件型号识别到从器件,基于第二从器件型号识别从器件,接着不断周而复始,直至识别到从器 件或者基于最后一个型号识别从器件。轮询也可以称为“程控输入输出”(programmed I/O)。2. Polling: It is a way for the master device to decide how to provide slave device services. Specifically, the master device issues an inquiry and identifies the slave device according to the possible model of the slave device; if the master device identifies the slave device based on the first slave device model, initialization configuration is performed based on the first slave device model; if it is not based on the first slave device model, The device model identifies the slave device, the slave device is identified based on the second slave device model, and then the cycle continues until the slave device is identified or the slave device is identified based on the last model number. Polling can also be called "programmed I/O".
本申请实施例中,主器件按照预先存储的标识寄存器的顺序向从器件发出询问,当主器件读取的从器件的值与该器件标识对应的预设值一致时,主器件识别到该从器件,配置该从器件。In the embodiment of the present application, the master device sends inquiries to the slave devices in the order of the pre-stored identification registers. When the value of the slave device read by the master device is consistent with the preset value corresponding to the device identification, the master device recognizes the slave device. , configure the slave device.
3、复位(power on reset,por):是指器件第一次上电或者断电后上电时,器件中的寄存器都回到初始状态的过程。示例性的,当电子设备开机启动时,主器件和从器件均可能处于初始状态,从初态开始工作。3. Reset (power on reset, por): refers to the process in which the registers in the device return to their initial state when the device is powered on for the first time or after a power outage. For example, when the electronic device is turned on, both the master device and the slave device may be in an initial state and start working from the initial state.
下面结合附图对本申请实施例的应用场景进行说明。The application scenarios of the embodiments of the present application will be described below with reference to the accompanying drawings.
示例性的,图2为本申请实施例提供的一种应用场景示意图。如图2所示,电子设备包括主器件101和从器件102。主器件101和从器件102通过SPI总线连接。Illustratively, FIG. 2 is a schematic diagram of an application scenario provided by the embodiment of the present application. As shown in FIG. 2 , the electronic device includes a master device 101 and a slave device 102 . Master device 101 and slave device 102 are connected through an SPI bus.
主器件101用于通过SPI总线获取从器件102的数据和/或控制从器件102等,进而实现电子设备的一种或多种功能。示例性的,以主器件为CPU,从器件为温度传感器为例,CPU通过SPI总线获取温度传感器检测的温度,并基于该温度执行温度处理策略。CPU还可以通过SPI总线调节温度传感器检测频率等。The master device 101 is used to obtain data from the slave device 102 through the SPI bus and/or control the slave device 102, etc., thereby realizing one or more functions of the electronic device. For example, taking the master device as a CPU and the slave device as a temperature sensor, the CPU obtains the temperature detected by the temperature sensor through the SPI bus and executes a temperature processing strategy based on the temperature. The CPU can also adjust the temperature sensor detection frequency through the SPI bus.
本申请实施例中,主器件101通过SPI总线可以兼容多个型号的从器件连接。而不同型号的从器件对应的器件原理、内部结构、软件实现等方面会有差异。因此,在主器件上电或者从器件上电后,主器件需要对从器件的型号进行识别,以对从器件进行初始化配置,进而实现电子设备的一种或多种功能。In this embodiment of the present application, the master device 101 is compatible with multiple models of slave devices connected through the SPI bus. Different types of slave devices will have differences in their corresponding device principles, internal structures, software implementation, etc. Therefore, after the master device is powered on or the slave device is powered on, the master device needs to identify the model of the slave device to initialize the configuration of the slave device, thereby realizing one or more functions of the electronic device.
具体的,主器件101可以通过SPI总线读取或改写从器件102中寄存器的数值,以实现对从器件102型号的识别、数据的获取以及控制等。Specifically, the master device 101 can read or rewrite the value of the register in the slave device 102 through the SPI bus to realize the identification of the model of the slave device 102, data acquisition and control, etc.
为方便理解,下面结合图3对从器件102的结构进行说明。To facilitate understanding, the structure of the slave device 102 will be described below with reference to FIG. 3 .
从器件102中包括多个寄存器。寄存器包括但不限于控制类寄存器、状态类寄存器、功能类寄存器和标识寄存器。 Slave device 102 includes multiple registers. Registers include but are not limited to control registers, status registers, function registers and identification registers.
控制类寄存器,用于控制和确定从器件的运行模式以及从器件的工作的特性等。Control class registers are used to control and determine the operating mode of the slave device and the working characteristics of the slave device.
状态类寄存器,用于存放两类信息:一类信息是体现指令执行结果的各种状态信息(条件码),如有无进位(CF位)、有无溢出(OV位)、结果正负(SF位)、结果是否为零(ZF位)、奇偶标志位(P位)等;另一类信息是控制信息,如允许中断(IF位)、跟踪标志(TF位)等。Status registers are used to store two types of information: one type of information is various status information (condition codes) that reflect the execution results of instructions, such as whether there is a carry (CF bit), whether there is an overflow (OV bit), and whether the result is positive or negative ( SF bit), whether the result is zero (ZF bit), parity flag bit (P bit), etc.; another type of information is control information, such as enable interrupt (IF bit), tracking flag (TF bit), etc.
功能类寄存器用于存放相应功能部件的控制命令,状态或数据。Functional registers are used to store control commands, status or data of corresponding functional components.
标识寄存器用于存储器件标识,以方便主器件区分从器件的类型。The identification register is used to store device identification to facilitate the master device to distinguish the type of slave device.
可以理解的是,从器件中的每个寄存器均对应有一个地址,不同地址对应的寄存器对应的功能不同。示例性的,如图3所示,从器件包括多个寄存器,分别为01寄存器、02寄存器、03寄存器等。以从器件为温度传感器为例,01寄存器可以为状态类寄存器,用于存放温度是否异常的状态信息;02寄存器可以为控制类寄存器,用于存放检测的频率;03寄存器可以为标识寄存器,用于存放器件标识。图3所示的从器件还可以包括功能类寄存器,用于存放检测的温度。It can be understood that each register in the slave device corresponds to an address, and registers corresponding to different addresses have different functions. For example, as shown in Figure 3, the slave device includes multiple registers, namely register 01, register 02, register 03, etc. Taking the slave device as a temperature sensor as an example, register 01 can be a status register, used to store status information about whether the temperature is abnormal; register 02 can be a control register, used to store the detection frequency; register 03 can be an identification register, used To store device identification. The slave device shown in Figure 3 can also include a functional register for storing the detected temperature.
此外,不同型号的从器件对应的寄存器数量可能不同。相同地址对应的寄存器可能不同。示例性的,图3中01寄存器可以为标识寄存器,用于存放器件标识。02寄 存器可以为状态类寄存器,用于存放温度是否异常的状态信息;03寄存器可以为控制类寄存器,用于存放检测的频率。本申请实施例对于从器件中寄存器的具体功能和每个功能对应的寄存器的地址不做限定。In addition, the number of registers corresponding to different models of slave devices may be different. Registers corresponding to the same address may be different. For example, register 01 in Figure 3 can be an identification register, used to store device identification. Register 02 can be a status register, used to store status information about whether the temperature is abnormal; register 03 can be a control register, used to store the frequency of detection. The embodiments of this application do not limit the specific functions of the registers in the slave device and the addresses of the registers corresponding to each function.
本申请实施例中,主器件101可以为电子设备中的处理器(central processing unit,CPU)、系统级芯片(system on chip,SOC)、微控制器(micro control unit,MCU)、微处理器(MPU)和可编程片上系统(system-on-a-programmable-chip,SOPC),等。In the embodiment of the present application, the main device 101 may be a processor (central processing unit, CPU), system on chip (SOC), microcontroller (micro control unit, MCU), or microprocessor in an electronic device (MPU) and system-on-a-programmable-chip (SOPC), etc.
从器件102可以为电子设备中的外围器件。外围器件具体可以参照下面图4中电子设备的硬件架构说明,此处不再赘述。The slave device 102 may be a peripheral device in the electronic device. For specific peripheral devices, please refer to the hardware architecture description of the electronic device in Figure 4 below, and will not be described again here.
示例性的,图4为本申请实施例提供的一种电子设备的硬件结构示意图。如图4所示,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriberidentification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Exemplarily, FIG. 4 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application. As shown in Figure 4, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, Antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , display screen 194, and subscriber identification module (subscriberidentification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), an image signal processor ( image signal processor (ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be recalled from memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C或IIC)接口,串行外设接口(serial peripheral interface,SPI)、集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus, USB)接口等。In some embodiments, processor 110 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C or IIC) interface, serial peripheral interface (SPI), integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, pulse code modulation (pulse code) modulation (PCM) interface, universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, Subscriber identity module (SIM) interface, and/or universal serial bus (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces. For example, the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .
SPI接口是一种高速的同步串行通信总线,具体结构可以参照上述相关概念的说明。在一些实施例中,处理器110可以包含多组SPI总线。处理器110可以通过不同的SPI总线接口分别耦合温度传感器180J,充电器,闪光灯,摄像头193等外围器件。例如:处理器110可以通过SPI接口耦合温度传感器180J,使处理器110与温度传感器180J通过SPI总线接口通信,实现电子设备100基于温度传感器180J检测的温度,执行温度处理策略,实现温度调节功能。The SPI interface is a high-speed synchronous serial communication bus. For the specific structure, please refer to the description of the above related concepts. In some embodiments, processor 110 may include multiple sets of SPI buses. The processor 110 can couple peripheral devices such as the temperature sensor 180J, charger, flash, camera 193, etc. through different SPI bus interfaces. For example, the processor 110 can be coupled to the temperature sensor 180J through the SPI interface, so that the processor 110 and the temperature sensor 180J communicate through the SPI bus interface, so that the electronic device 100 can execute a temperature processing strategy based on the temperature detected by the temperature sensor 180J to implement the temperature adjustment function.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 . In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。I2S接口和PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(displayserial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (displayserial interface, DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 . The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机 播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are schematic illustrations and do not constitute a structural limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In some other embodiments, the power management module 141 may also be provided in the processor 110 . In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Antennas in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。The mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite systems. (global navigation satellite system, GNSS), frequency modulation (FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像、显示视频和接收滑动操作等。显示屏194包括显示面板。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, display videos, receive sliding operations, and the like. Display 194 includes a display panel. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the light signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. In some embodiments, the ISP may be provided in the camera 193.
摄像头193用于捕获静态图像或视频。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频。Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
内部存储器121可以用于存储计算机可执行程序代码,可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。Internal memory 121 may be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.). The storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to hands-free calls.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。 Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。 Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions, etc.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The headphone interface 170D is used to connect wired headphones. The headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可 以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor may comprise at least two parallel plates of conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is performed on the display screen 194, the electronic device 100 detects the strength of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x、y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。Magnetic sensor 180D includes a Hall sensor. The electronic device 100 may utilize the magnetic sensor 180D to detect opening and closing of the flip holster. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别终端设备姿态,应用于横竖屏切换,计步器等应用程序。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of terminal devices and be used in applications such as horizontal and vertical screen switching, pedometers, etc.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outwardly through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in holster mode, and pocket mode automatically unlocks and locks the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。Fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施 热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。Temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also known as "touch device". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。Bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part. The bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals. In some embodiments, the bone conduction sensor 180M can also be provided in an earphone and combined into a bone conduction earphone. The audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibrating bone obtained by the bone conduction sensor 180M to implement the voice function. The application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to implement the heart rate detection function.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The buttons 190 include a power button, a volume button, etc. Key 190 may be a mechanical key. It can also be a touch button. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用程序(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 can generate vibration prompts. The motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. The motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 . Different application scenarios (such as time reminders, receiving information, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 . The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. Multiple cards can be of the same type or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
上述图4所示的电子设备中,主器件可以为处理器,从器件可以为外围器件,例如,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriberidentification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C, 磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。In the electronic device shown in Figure 4 above, the master device can be a processor, and the slave devices can be peripheral devices, such as the charging management module 140, the power management module 141, the battery 142, the antenna 1, the antenna 2, and the mobile communication module 150. Wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module , SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
本申请实施例提供的器件识别方法,可以应用具有SPI接口的电子设备中。电子设备包括终端设备。终端设备也可以称为终端(terminal)、用户设备(user equipment,UE)、移动台(mobile station,MS)、移动终端(mobile terminal,MT)等。终端设备可以是手机(mobile phone)、智能电视、穿戴式设备、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self-driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等等。The device identification method provided by the embodiment of the present application can be applied to electronic equipment with an SPI interface. Electronic equipment includes terminal equipment. Terminal equipment can also be called terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets (Pads), computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminals Equipment, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grid, transportation Wireless terminals in transportation safety, wireless terminals in smart city, wireless terminals in smart home, etc.
作为示例而非限定,在本申请实施例中,该终端设备还可以是可穿戴设备。可穿戴设备也可以称为穿戴式智能设备,是应用穿戴式技术对日常穿戴进行智能化设计、开发出可以穿戴的设备的总称,如眼镜、手套、手表、服饰及鞋等。可穿戴设备即直接穿在身上,或是整合到用户的衣服或配件的一种便携式设备。可穿戴设备不仅仅是一种硬件设备,更是通过软件支持以及数据交互、云端交互来实现强大的功能。广义穿戴式智能设备包括功能全、尺寸大、可不依赖智能手机实现完整或者部分的功能,例如:智能手表或智能眼镜等,以及只专注于某一类应用功能,需要和其它设备如智能手机配合使用,如各类进行体征监测的智能手环、智能首饰等。As an example and not a limitation, in this embodiment of the present application, the terminal device may also be a wearable device. Wearable devices can also be called wearable smart devices. It is a general term for applying wearable technology to intelligently design daily wear and develop wearable devices, such as glasses, gloves, watches, clothing and shoes, etc. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not just hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly defined wearable smart devices include full-featured, large-sized devices that can achieve complete or partial functions without relying on smartphones, such as smart watches or smart glasses, and those that only focus on a certain type of application function and need to cooperate with other devices such as smartphones. Use, such as various types of smart bracelets, smart jewelry, etc. for physical sign monitoring.
此外,在本申请实施例中,终端设备还可以是物联网(internet of things,IoT)系统中的终端设备,IoT是未来信息技术发展的重要组成部分,其主要技术特点是将物品通过通信技术与网络连接,从而实现人机互连,物物互连的智能化网络。In addition, in the embodiment of this application, the terminal device may also be a terminal device in the Internet of things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to transfer items through communication technology. Connect with the network to realize an intelligent network of human-computer interconnection and physical-object interconnection.
本申请的实施例对终端设备所采用的具体技术和具体设备形态不做限定。The embodiments of this application do not limit the specific technology and specific equipment form used by the terminal equipment.
电子设备在接收到用于指示开机的操作时,电子设备中的处理器需要识别通过SPI总线连接的外围器件的型号,以基于器件型号等对外围器件进行相应的初始化配置,进而实现电子设备相应的功能。When the electronic device receives an operation to instruct the power on, the processor in the electronic device needs to identify the model of the peripheral device connected through the SPI bus, so as to perform corresponding initialization configuration of the peripheral device based on the device model, etc., so as to realize the corresponding response of the electronic device. function.
可能的设计中,处理器通过轮询的方式读取外围器件的器件标识(chip id)实现外围器件的型号识别,进而对外围器件做相应的初始化配置。具体的,当电子设备接收到用于指示开机的操作时,主器件轮询次序和对应关系读取从器件中相应寄存器存储的值。当主器件读取的值与预设值相同时,主器件识别到从器件。当主器件读取的值与预设值不同时,基于轮询次序读取下一类型对应从器件的寄存器,直至识别到从器件或者轮询至最后一个从器件。当轮询至最后一个从器件时,未识别到从器件,从器件识别失败。In a possible design, the processor reads the device identification (chip id) of the peripheral device through polling to realize the model identification of the peripheral device, and then performs corresponding initialization configuration of the peripheral device. Specifically, when the electronic device receives an operation for instructing to turn on, the master device reads the value stored in the corresponding register in the slave device in polling sequence and corresponding relationship. When the value read by the master device is the same as the preset value, the master device recognizes the slave device. When the value read by the master device is different from the preset value, the register corresponding to the slave device of the next type is read based on the polling order until the slave device is identified or the last slave device is polled. When polling to the last slave device, the slave device is not recognized and the slave device identification fails.
示例性的,图5为可能的设计中器件识别方法的流程示意图。如图5所示,方法包括:For example, FIG. 5 is a schematic flowchart of a possible device identification method in the design. As shown in Figure 5, methods include:
S401、当电子设备接收到用于指示开机的操作时,主器件基于型号次序和对应关系读取从器件中寄存器的数值。S401. When the electronic device receives an operation for instructing to turn on, the master device reads the value of the register in the slave device based on model order and correspondence.
可以理解的是,主器件通过SPI总线可能兼容多个从器件连接。主器件按照预先 设置的型号的次序和对应关系读取从器件中相应寄存器的数值,以确认从器件的型号。It is understood that the master device may be compatible with multiple slave device connections through the SPI bus. The master device reads the value of the corresponding register in the slave device according to the preset model order and correspondence to confirm the slave device model.
本申请实施例中,对应关系为从器件型号、标识(chip id)寄存器地址以及预设值之间的关系。轮询次序与从器件型号相对应。In the embodiment of this application, the corresponding relationship is the relationship between the slave device model, the identification (chip id) register address and the preset value. The polling order corresponds to the slave device model.
可能的实现方式中,对应关系可以以表格的形式存储在主器件中。示例性的,从器件型号、标识寄存器地址以及预设值之间的对应关系如表1所示。In a possible implementation, the corresponding relationship can be stored in the main device in the form of a table. For example, the correspondence between the slave device model, identification register address and preset value is as shown in Table 1.
表1对应关系表Table 1 Correspondence table
型号model 标识寄存器地址Identification register address 预设值default value
AA 0×000×00 1111
BB 0×010×01 1212
从表1中可以看出,A型号对应的标识寄存器地址为0×00,即A型号对应的标识寄存器为0×00寄存器,预设值为11。可以理解的是,主器件基于从器件0×00寄存器对应的值和预设值可以识别从器件是否为A型号。当主器件基于从器件0×00寄存器对应的值为11时,识别从器件为A型号;当主器件基于从器件0×00寄存器对应的值不为11时,识别从器件不是A型号。As can be seen from Table 1, the identification register address corresponding to model A is 0×00, that is, the identification register corresponding to model A is the 0×00 register, and the default value is 11. It can be understood that the master device can identify whether the slave device is model A based on the value corresponding to the 0×00 register of the slave device and the preset value. When the master device is based on the value corresponding to the 0×00 register of the slave device and is 11, it identifies the slave device as model A; when the master device is based on the value corresponding to the 0×00 register of the slave device and is not 11, it identifies that the slave device is not model A.
B型号对应的标识寄存器为0×01寄存器,即B型号对应的标识寄存器为0×01寄存器预设值为12。可以理解为,主器件基于从器件0×01寄存器对应的值和预设值可以识别从器件是否为B型号。当主器件基于从器件0×01寄存器对应的值为12时,识别从器件为B型号;当主器件基于从器件0×01寄存器对应的值不为12时,识别从器件不是B型号。The identification register corresponding to model B is 0×01 register, that is, the identification register corresponding to model B is 0×01 register, and the default value is 12. It can be understood that the master device can identify whether the slave device is model B based on the value corresponding to the 0×01 register of the slave device and the preset value. When the master device corresponds to a value of 12 based on the 0×01 register of the slave device, it identifies the slave device as model B; when the master device identifies that the slave device is not a B model based on the value corresponding to the 0×01 register of the slave device is not 12.
S402、当主器件读取的值与预设值相同时,主器件识别到从器件。S402. When the value read by the master device is the same as the preset value, the master device recognizes the slave device.
适应性的,主器件在识别到从器件后,对从器件进行初始化配置。Adaptable, after the master device recognizes the slave device, it initializes the configuration of the slave device.
示例性的,以从器件为温度传感器为例,主器件为温度传感器中的寄存器中配置新的值,例如,该值用于指示温度传感器采集环境中的温度的频率等。For example, taking the slave device as a temperature sensor, the master device configures a new value in a register in the temperature sensor. For example, the value is used to indicate the frequency at which the temperature sensor collects temperature in the environment.
S403、当主器件读取的从器件的值与预设值不同时,主器件确认轮询是否完成。S403. When the value of the slave device read by the master device is different from the preset value, the master device confirms whether polling is completed.
当主器件未轮询至最后一个型号的从器件时,主器件执行S401。当主器件的轮询至最后一个型号的从器件时,主器件识别从器件失败。When the master device does not poll the last slave device model, the master device executes S401. When the master device polls to the last model of slave device, the master device fails to identify the slave device.
示例性的,以SPI接口兼容连接的从器件为A型号和B型号为例,如图6所示,识别流程如下:For example, taking the slave devices compatible with the SPI interface as model A and model B, as shown in Figure 6, the identification process is as follows:
S501、当电子设备接收到用于指示开机的操作时,主器件基于A型号对应的寄存器地址读取从器件中寄存器的数值。S501. When the electronic device receives an operation for instructing to turn on, the master device reads the value of the register in the slave device based on the register address corresponding to model A.
示例性的,主器件读取A型号对应的标识寄存器,即0×00寄存器。For example, the master device reads the identification register corresponding to model A, that is, the 0×00 register.
S502、当主器件读取的值与A型号对应的的预设值相同时,主器件识别从器件为A型号。S502. When the value read by the master device is the same as the preset value corresponding to model A, the master device identifies the slave device as model A.
适应性的,主器件基于A型号对从器件进行初始化设置。Adaptable, the master device initializes the slave device based on the A model.
S503、当主器件读取的值与A型号对应的的预设值不同时,主器件基于B型号对应的寄存器地址读取从器件中寄存器的数值。S503. When the value read by the master device is different from the preset value corresponding to model A, the master device reads the value of the register in the slave device based on the register address corresponding to model B.
S504、当主器件读取的值与B型号对应的的预设值相同时,主器件识别从器件为B型号。S504. When the value read by the master device is the same as the preset value corresponding to model B, the master device identifies the slave device as model B.
适应性的,主器件基于B型号对从器件进行初始化设置。Adaptable, the master device initializes the slave device based on the B model.
S505、当主器件读取的值与B型号对应的的预设值不同时,主器件识别从器件失败。S505. When the value read by the master device is different from the preset value corresponding to model B, the master device fails to identify the slave device.
主器件基于第一从器件型号对应的标识寄存器地址读取从器件中相应寄存器的数值;当主器件读取的值与对应关系中的预设值相同时,主器件识别到从器件为第一从器件型号。当主器件读取值与对应关系中的预设值不同时,主器件基于下一型号对应的标识寄存器地址读取从器件中相应寄存器的数值,直至识别到从器件或者轮询至最后一个从器件。当轮询至最后一个型号的从器件时,主器件未识别到从器件,从器件识别失败。The master device reads the value of the corresponding register in the slave device based on the identification register address corresponding to the first slave device model; when the value read by the master device is the same as the preset value in the corresponding relationship, the master device recognizes that the slave device is the first slave device. Device model. When the value read by the master device is different from the preset value in the corresponding relationship, the master device reads the value of the corresponding register in the slave device based on the identification register address corresponding to the next model until the slave device is identified or the last slave device is polled. . When polling to the last model of slave device, the master device did not recognize the slave device and the slave device recognition failed.
但是,上述图5和图6所示的流程中,主器件在识别从器件时可能会出错,从而导致从器件无法使用,电子设备相应的功能无法使用,用户体验差。However, in the above-mentioned processes shown in Figures 5 and 6, the master device may make errors when identifying the slave device, resulting in the slave device being unusable, the corresponding functions of the electronic device being unusable, and the user experience being poor.
示例性的,以主器件通过SPI接口兼容连接A型号从器件和B型号从器件为例,主器件可能会将B型号从器件识别为A型号从器件。具体的,主器件基于A型号对应的寄存器地址读取从器件中寄存器的数值时,B型号从器件中相应寄存器对应的值与A型号对应的预设值相同。For example, if the master device compatiblely connects the model A slave device and the model B slave device through the SPI interface, the master device may recognize the model B slave device as the model A slave device. Specifically, when the master device reads the value of the register in the slave device based on the register address corresponding to the A model, the value corresponding to the corresponding register in the B model slave device is the same as the preset value corresponding to the A model.
为方便理解,示例性的给出从器件中两个型号对应的寄存器列表。To facilitate understanding, the register list corresponding to the two models in the slave device is given as an example.
表2寄存器列表Table 2 Register List
型号model 寄存器地址Register address value
AA 0×000×00 1111
  0×010×01 1313
BB 0×000×00 保留(reserved)reserved
  0×010×01 1212
需要说明的是,从器件中有部分寄存器为保留(reserved)寄存器,可以理解为未被公开的寄存器。保留(reseverd)寄存器可能为仅在器件设计研发阶段调试使用的寄存器;还可能为器件在设计上有功能,但由于生产工艺等问题,对应的功能不能实现的寄存器等。It should be noted that some registers in the slave device are reserved registers, which can be understood as undisclosed registers. Reserved registers may be registers that are only used for debugging during the device design and development phase; they may also be registers that have functions in the device design, but the corresponding functions cannot be realized due to production process and other issues.
可以理解的是,保留寄存器对应的值可能为1个固定值,也可能为随机值,还可能对应于多个固定值。It can be understood that the value corresponding to the reserved register may be a fixed value, a random value, or multiple fixed values.
下面结合表2和图7对误识别过程进行说明。示例性的,以从器件的型号为B型号,主器件按照A型号和B型号顺序识别从器件为例,识别流程包括:The misidentification process will be described below in conjunction with Table 2 and Figure 7. For example, assuming that the model of the slave device is model B, and the master device identifies the slave device in order of model A and model B, the identification process includes:
S601、当电子设备接收到用于指示开机的操作时,主器件基于A型号对应的寄存器地址读取从器件中寄存器的数值。S601. When the electronic device receives an operation for instructing to turn on, the master device reads the value of the register in the slave device based on the register address corresponding to model A.
示例性的,主器件读取A型号对应的标识寄存器,即0×00寄存器。For example, the master device reads the identification register corresponding to model A, that is, the 0×00 register.
S602、当从器件反馈的值与A型号对应的的预设值相同时,主器件识别从器件为A型号。S602. When the value fed back by the slave device is the same as the preset value corresponding to model A, the master device identifies the slave device as model A.
适应性的,主器件基于A型号进行初始化设置。Adaptable, the master device is initialized based on the A model.
示例性的,当从器件为B型号时,0×00寄存器为保留寄存器,其对应的值可能也为11,因此从器件反馈的值为11,与A型号对应的预设值相同,主器件将从器件误识别为A型号。For example, when the slave device is model B, the 0×00 register is a reserved register, and its corresponding value may also be 11. Therefore, the value fed back by the slave device is 11, which is the same as the preset value corresponding to model A. The master device The slave device is misidentified as model A.
当主器件基于A型号进行初始化配置时,可能会导致从器件初始化配置错误,进 而从器件无法正常运行,相应的功能失效。When the master device performs initial configuration based on model A, it may cause the slave device to initialize configuration errors, and then the slave device cannot operate normally and the corresponding functions fail.
有鉴于此,本申请实施例提供一种器件识别方法,主器件可以读取从器件中两个不同的寄存器的数值,得到对应的两个值进行验证当两次的值均符合预期时,器件识别成功。这样,进行二次识别,减少因不同型号从器件中的相同地址寄存器对应的值相同,导致器件误识别初始化配置失败的情况,优化用户体验。此外,未改动电子设备的硬件结构,成本友好,提高系统设计灵活性,提高产品物料供应的稳定性。In view of this, embodiments of the present application provide a device identification method. The master device can read the values of two different registers in the slave device and obtain the corresponding two values for verification. When the two values are in line with expectations, the device Recognition successful. In this way, secondary recognition is performed to reduce the situation where the device misrecognizes the initialization configuration and fails due to the same value corresponding to the same address register in different models of slave devices, and optimizes the user experience. In addition, the hardware structure of the electronic equipment is not changed, which is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
下面结合附图对本申请实施例提供的器件识别方法进行说明。The device identification method provided by the embodiment of the present application will be described below with reference to the accompanying drawings.
示例性的,图8为本申请实施例提供的一种从器件识别方法流程示意图,如图8所示,方法包括:Exemplarily, Figure 8 is a schematic flowchart of a slave device identification method provided by an embodiment of the present application. As shown in Figure 8, the method includes:
S701、当电子设备开机初始化时,主器件基于从器件型号次序和对应关系读取从器件中寄存器的数值,得到第一值和/或第二值;对应关系包括从器件型号、第一地址、第一预设值、第二地址和第二预设值之间的关系。S701. When the electronic device is powered on and initialized, the master device reads the value of the register in the slave device based on the slave device model order and correspondence relationship, and obtains the first value and/or the second value; the correspondence relationship includes the slave device model, first address, The relationship between the first preset value, the second address and the second preset value.
可以理解的是,在电子设备开机时,主器件从下电状态切换为上电状态,开始对从器件进行识别。It can be understood that when the electronic device is turned on, the master device switches from the power-off state to the power-on state and begins to identify the slave device.
本申请实施例中,第一地址可以为不同型号从器件对应的标识寄存器对应的地址,第二地址可以为不同型号从器件对应的复查寄存器对应的地址。标识寄存器为存储器件标识的寄存器,用于区分器件型号。复查寄存器用于对器件型号进行验证的寄存器。In the embodiment of the present application, the first address may be the address corresponding to the identification register corresponding to the slave device of different models, and the second address may be the address corresponding to the review register corresponding to the slave devices of different models. The identification register is a register that stores device identification and is used to distinguish device models. Review Register A register used to verify the device model.
示例性的,以从器件型号为A型号和B型号为例,A型号对应的标识寄存器地址为0×00,第一预设值为11;A型号对应的复查寄存器地址为0×01,第二预设值为12。B型号对应的标识寄存器地址为0×01寄存器,第一预设值为12;B型号对应的复查寄存器地址为0×02,第二预设值为14。For example, taking the slave device models as model A and model B, the identification register address corresponding to model A is 0×00, and the first preset value is 11; the review register address corresponding to model A is 0×01, and the first preset value is 0×01. The default value is 12. The identification register address corresponding to model B is 0×01 register, and the first preset value is 12; the review register address corresponding to model B is 0×02, and the second preset value is 14.
可以理解的是,可以通过地址确认从器件中多个寄存器中的一个,地址也可以理解为寄存器编号。It can be understood that one of the multiple registers in the slave device can be identified by the address, and the address can also be understood as a register number.
可能的实现方式中,上述对应关系可以以表格的形式存储在主器件中。示例性的,如表3所示。In a possible implementation, the above correspondence relationship can be stored in the main device in the form of a table. Illustrative, as shown in Table 3.
表3对应关系表Table 3 Correspondence table
Figure PCTCN2023071238-appb-000001
Figure PCTCN2023071238-appb-000001
可以理解的是,主器件基于第一地址和第二地址读取从器件中寄存器的数值,得到第一值和第二值。本申请实施例中,主器件可以先基于第一地址读取从器件中寄存器的数值得到第一值;也可以先基于第二地址读取从器件中寄存器的数值得到第二值。此处不做限定。It can be understood that the master device reads the value of the register in the slave device based on the first address and the second address, and obtains the first value and the second value. In the embodiment of the present application, the master device may first read the value of the register in the slave device based on the first address to obtain the first value; it may also first read the value of the register in the slave device based on the second address to obtain the second value. There are no limitations here.
本申请实施例中,不同型号的从器件对应的第二地址可以相同,也可以不同,本申请实施例对此不作限定。In the embodiment of the present application, the second addresses corresponding to the slave devices of different models may be the same or different, which is not limited in the embodiment of the present application.
可以理解的是,主器件通过SPI总线可以兼容多个从器件连接。主器件按照预先设置的型号的次序和对应关系读取从器件中相应寄存器的数值,以确认从器件的型号。It can be understood that the master device is compatible with multiple slave device connections through the SPI bus. The master device reads the value of the corresponding register in the slave device according to the preset model order and correspondence to confirm the slave device model.
S702、当第一值与第一预设值相同,且第二值与第二预设值相同时,主器件识别 到从器件,并基于型号对从器件进行初始化配置,第二值主器件配置从器件之前为定值。S702. When the first value is the same as the first preset value and the second value is the same as the second preset value, the master device recognizes the slave device and initializes the slave device based on the model. The second value master device configures The slave device was previously a fixed value.
S703、当第一值与第一预设值不同或者第二值与第二预设值不同时,主器件确认轮询是否完成。S703. When the first value is different from the first preset value or the second value is different from the second preset value, the master device confirms whether polling is completed.
示例性的,主器件基于型号次序确认轮询是否完成。当主器件未基于最后一个型号和对应关系读取从器件中寄存器的数值时,轮询未完成,主器件执行S701直至识别到从器件或者轮询完成。当主器件基于最后一个型号和对应关系读取从器件中寄存器的数值时,轮询完成,主器件识别从器件失败。For example, the master device confirms whether polling is completed based on model order. When the master device does not read the value of the register in the slave device based on the last model and corresponding relationship, the polling is not completed, and the master device executes S701 until the slave device is recognized or the polling is completed. When the master device reads the value of the register in the slave device based on the last model and corresponding relationship, polling is completed and the master device fails to identify the slave device.
可能的实现方式中,主器件在识别从器件失败时,基于预设型号配置从器件。In a possible implementation, when the master device fails to identify the slave device, it configures the slave device based on the preset model.
可能的实现方式中,主器件在基于型号次序和对应关系读取从器件中寄存器的数值得到第二值之前,控制从器件复位。In a possible implementation, the master device controls the slave device to reset before reading the value of the register in the slave device based on model order and correspondence to obtain the second value.
综上,主器件通过读取从器件中两个不同的寄存器的数值,进行验证。这样,降低不同型号从器件中的相同地址寄存器对应的值相同的概率,减少器件误识别的情况。此外,未改动电子设备的硬件结构,成本友好,提高系统设计灵活性,提高产品物料供应的稳定性。In summary, the master device verifies by reading the values of two different registers in the slave device. In this way, the probability that the same address register in different models of slave devices corresponds to the same value is reduced, and the misidentification of the device is reduced. In addition, the hardware structure of the electronic equipment is not changed, which is cost-friendly, improves system design flexibility, and improves the stability of product material supply.
下面结合图9对电子设备开机初始化的过程中器件识别方法进行说明。示例性的,如图9所示,The device identification method during the power-on initialization process of the electronic device will be described below with reference to Figure 9. For example, as shown in Figure 9,
S801、当电子设备接收到用于指示开机的操作时,主器件基于A型号对应的标识寄存器地址读取从器件中寄存器的数值,得到A型号对应的第一值。S801. When the electronic device receives an operation for instructing to turn on, the master device reads the value of the register in the slave device based on the identification register address corresponding to model A, and obtains the first value corresponding to model A.
可以理解的是,主器件通过SPI总线与多个从器件连接。主器件按照预先设置的轮询次序和对应关系通过轮询的方式确认从器件的型号。对应关系为从器件型号、标识寄存器地址、第一预设值、复查寄存器地址以及第二预设值之间的关系。轮询次序与从器件型号相对应。It can be understood that the master device is connected to multiple slave devices through the SPI bus. The master device confirms the model of the slave device through polling according to the preset polling order and corresponding relationship. The corresponding relationship is the relationship between the slave device model, the identification register address, the first preset value, the review register address and the second preset value. The polling order corresponds to the slave device model.
可能的实现方式中,对应关系可以以表格的形式存储在主器件中。示例性的,从器件型号、标识寄存器地址、第一预设值、复查寄存器地址以及第二预设值之间的对应关系可以如上述表3所示。In a possible implementation, the corresponding relationship can be stored in the main device in the form of a table. For example, the corresponding relationship between the slave device model, the identification register address, the first preset value, the review register address, and the second preset value can be as shown in Table 3 above.
从表3中可以看出,A型号对应的标识寄存器地址为0×00,第一预设值为11;A型号对应的复查寄存器地址为0×01,第二预设值为12。B型号对应的标识寄存器地址为0×01寄存器,第一预设值为12;B型号对应的复查寄存器地址为0×02,第二预设值为14。As can be seen from Table 3, the identification register address corresponding to model A is 0×00, and the first preset value is 11; the review register address corresponding to model A is 0×01, and the second preset value is 12. The identification register address corresponding to model B is 0×01 register, and the first preset value is 12; the review register address corresponding to model B is 0×02, and the second preset value is 14.
可以理解的是,当主器件读取从器件的0×00寄存器的数值,得到第一值为11,且主器件读取从器件的0×01寄存器的数值,得到的第二值为13时,从器件为A型号。当主器件读取从器件的0×01寄存器的数值,得到的第一值为12,且主器件读取从器件的0×02寄存器的数值得到的第二值为14时,从器件为B型号。It can be understood that when the master device reads the value of the 0×00 register of the slave device and obtains the first value of 11, and the master device reads the value of the 0×01 register of the slave device and obtains the second value of 13, The slave device is model A. When the master device reads the value of the 0×01 register of the slave device and the first value obtained is 12, and the master device reads the value of the 0×02 register of the slave device and obtains the second value 14, the slave device is model B. .
本申请实施例中,复查(double check)寄存器与标识寄存器不同。复查(double check)寄存器对应的地址与标识寄存器对应的地址不同。In the embodiment of this application, the double check register is different from the identification register. The address corresponding to the double check register is different from the address corresponding to the identification register.
本申请实施例中,不同型号的从器件对应的复查寄存器的地址可以相同,也可以不同,本申请实施例对此不作限定。In the embodiment of the present application, the addresses of the review registers corresponding to the slave devices of different models may be the same or different, which is not limited in the embodiment of the present application.
可能的实现方式中,不同型号的从器件对应的复查寄存器的地址相同,对应的第 二预设值不同。In a possible implementation, the addresses of the review registers corresponding to different models of slave devices are the same, but the corresponding second preset values are different.
这样,复查寄存器的地址相同,主器件读取一次寄存器,即可区分不同型号的从器件。此外,还可以减少误识别的风险。In this way, the address of the review register is the same, and the master device can distinguish different models of slave devices by reading the register once. In addition, the risk of misidentification can be reduced.
本申请实施例中,复查(double check)寄存器可以为上电后稳定的寄存器,也可以为不稳定的寄存器。In the embodiment of the present application, the double check register may be a stable register after power-on or an unstable register.
可以理解的是,不稳定的寄存器可以为保留寄存器和值被修改的寄存器,等。It is understood that unstable registers can be reserved registers, registers whose values have been modified, etc.
一些寄存器在器件运行过程中可能会被进行读写操作,导致寄存器对应的值被修改。该寄存器可以为用于数据输出的寄存器、用于指示模式切换的寄存器、以及用于指示异常情况的寄存器等。Some registers may be read or written during device operation, causing the corresponding value of the register to be modified. The register may be a register for data output, a register for indicating mode switching, a register for indicating abnormal conditions, etc.
示例性的,以温度传感器为例,不稳定的寄存器可以为:用于存储检测的温度的寄存器、未公开的保留寄存器等。For example, taking a temperature sensor as an example, the unstable register may be: a register used to store the detected temperature, an undisclosed retention register, etc.
稳定的寄存器可以为:值未被修改的寄存器,例如报值固定且从器件使用过程中未被读写操作过的控制寄存器等。Stable registers can be: registers whose values have not been modified, such as control registers that have a fixed value and have not been read or written during the use of the slave device.
示例性的,以温度传感器为例,稳定的寄存器可以为:中断控制寄存器,该寄存器上电复位后报值固定且非零,该中断控制寄存器用于控制中断功能的使能,处理器未操作过该中断控制寄存器,可以预见该寄存器在温度传感器上电稳定后,其寄存器值是固定的。For example, taking the temperature sensor as an example, the stable register can be: interrupt control register. The reported value of this register is fixed and non-zero after power-on reset. This interrupt control register is used to control the enablement of the interrupt function. The processor is not operating. Through the interrupt control register, it can be predicted that the register value of this register will be fixed after the temperature sensor is powered on and stabilized.
可能的实现方式中,复查(double check)寄存器为上电后稳定的寄存器。这样,可以减少寄存器中的值被改变导致的识别失败的情况,提高识别的成功率。In a possible implementation, the double check register is a register that is stable after power-on. In this way, the identification failure caused by the value in the register being changed can be reduced and the success rate of identification can be improved.
可能的实现方式中,复查寄存器为非零寄存器。可以理解的是,多数寄存器上电复位后寄存器报值为0,以及寄存器异常时报值通常为0。这样,选择非零寄存器可以进一步减少误识别,提高本申请实施例稳定性。In a possible implementation, the review register is a non-zero register. It is understandable that most registers report a value of 0 after power-on reset, and the value of a register is usually 0 when an exception occurs. In this way, selecting a non-zero register can further reduce misidentification and improve the stability of the embodiment of the present application.
可能的实现方式中,复查寄存器为上电后报值固定且非零的寄存器。这样,可以减少寄存器中的值被改变导致的识别失败的情况,提高识别的成功率。In a possible implementation, the review register is a register whose reported value is fixed and non-zero after power-on. In this way, the identification failure caused by the value in the register being changed can be reduced and the success rate of identification can be improved.
S802、当A型号对应的第一值与A型号对应第一预设值相同时,主器件基于A型号对应的复查寄存器地址读取从器件中寄存器的数值,得到A型号对应的第二值。S802. When the first value corresponding to model A is the same as the first preset value corresponding to model A, the master device reads the value of the register in the slave device based on the review register address corresponding to model A, and obtains the second value corresponding to model A.
S803、当A型号对应的第二值与A型号对应第二预设值相同时,主器件识别从器件为A型号。S803. When the second value corresponding to model A is the same as the second preset value corresponding to model A, the master device identifies the slave device as model A.
适应性的,主器件基于A型号配置从器件。Adaptable, the master device configures the slave device based on the A model.
S804、当A型号对应的第一值与A型号对应第一预设值不同,或者A型号对应的第二值与A型号对应第二预设值不同时,主器件确认轮询是否完成。S804. When the first value corresponding to model A is different from the first preset value corresponding to model A, or the second value corresponding to model A is different from the second preset value corresponding to model A, the master device confirms whether polling is completed.
当A型号不是最后一个型号时,轮询未完成,主器件基于B型号对应的标识寄存器地址读取从器件中寄存器的数值,得到B型号对应的第一值。When model A is not the last model, polling is not completed. The master device reads the value of the register in the slave device based on the identification register address corresponding to model B, and obtains the first value corresponding to model B.
当A型号为最后一个型号时,主器件识别从器件失败。When model A is the last model, the master device fails to identify the slave device.
综上,在基于第一从器件型号识别从器件时,读取从器件中两个不同的寄存器的数值,进行验证。这样,降低不同型号从器件中的相同地址寄存器对应的值相同的概率,减少器件误识别的情况。In summary, when identifying the slave device based on the first slave device model, read the values of two different registers in the slave device for verification. In this way, the probability that the same address register in different models of slave devices corresponds to the same value is reduced, and the misidentification of the device is reduced.
在上述实施例的基础上,方法还包括S805。S805、在主器件基于复查寄存器地址读取从器件中寄存器的数值之前,主器件控制从器件复位。Based on the above embodiment, the method also includes S805. S805. Before the master device reads the value of the register in the slave device based on the review register address, the master device controls the slave device to reset.
需要说明的是,在电子设备的使用过程中,从器件中的部分寄存器对应的值可能会发生变化。示例性的,以从器件为温度传感器为例,用于存储检测的温度的寄存器可能会被多次改写,以存储最近一次检测得到的温度。以默认值为20,检测的温度未30为例,用于存储检测的温度的寄存器对应的值可能从20改写为30。It should be noted that during the use of electronic equipment, the values corresponding to some registers in the slave device may change. For example, if the slave device is a temperature sensor, the register used to store the detected temperature may be rewritten multiple times to store the latest detected temperature. Taking the default value as 20 and the detected temperature as less than 30 as an example, the corresponding value of the register used to store the detected temperature may be rewritten from 20 to 30.
这样,将从器件复位将从器件中寄存器的数值恢复至默认值,可以减少复查寄存器对应的值被改写等情况导致的识别失败或者误识别。In this way, resetting the slave device will restore the value of the register in the slave device to the default value, which can reduce recognition failure or misrecognition caused by the value corresponding to the review register being overwritten.
在上述实施例的基础上,方法还包括S806。S806、当主器件识别从器件失败时,基于预设型号配置从器件。这样,主器件可能会基于预设型号成功配置从器件,使得从器件可以正常运行,进而实现电子设备的功能。Based on the above embodiment, the method also includes S806. S806. When the master device fails to identify the slave device, configure the slave device based on the preset model. In this way, the master device may successfully configure the slave device based on the preset model, so that the slave device can operate normally, thereby realizing the functions of the electronic device.
可能的实现方式中,预设型号可以为电子设备中使用次数最多从器件对应的型号。这样,提高主器件成功配置从器件的可能性。In a possible implementation, the preset model may be a model corresponding to the most frequently used slave device in the electronic device. This increases the likelihood that the master will successfully configure the slave.
在上述实施例的基础上,主器件可以多次基于标识寄存器地址和/或复查寄存器地址对从器件的型号进行验证。这样,进一步减少误识别情况。Based on the above embodiments, the master device may verify the model number of the slave device based on the identification register address and/or the review register address multiple times. In this way, misrecognition situations are further reduced.
可以理解的是,上述图9所示的流程中SPI接口兼容A型号和B型号的从器件仅为示例,实际应用中,SPI接口还可以兼容更多型号的从器件,本申请实施例对于SPI接口兼容的从器件的型号、类型不做限定。It can be understood that the SPI interface compatible with slave devices of model A and model B in the process shown in Figure 9 is only an example. In actual applications, the SPI interface can also be compatible with more models of slave devices. The embodiment of this application is for SPI The model and type of interface-compatible slave devices are not limited.
在上述实施例中,SPI接口兼容的从器件可以为相同类型的不同型号的从器件,也可以为不同类型的从器件。本申请实施例对此不作限定。In the above embodiment, the slave devices compatible with the SPI interface may be slave devices of different models of the same type, or may be slave devices of different types. The embodiments of the present application do not limit this.
需要说明的是,当电子设备开机或者重启时,主器件从下电状态切换为上电状态,主器件需要识别并配置从器件。当从器件从下电状态切换为上电状态时,主器件也需要识别并配置从器件。It should be noted that when the electronic device is turned on or restarted, the master device switches from the power-off state to the power-on state, and the master device needs to identify and configure the slave device. When the slave device switches from the power-down state to the power-on state, the master device also needs to identify and configure the slave device.
本申请实施例提供的方法还可以适用于从器件从下电状态切换为上电状态的情况下,发生还可以适用于从器件下电后上电的过程中。例如,电子设备的软件系统出现问题导致从器件下电后上电,或者从器件发生闩锁(lanch-up)导致从器件下电后上电。The method provided by the embodiment of the present application can also be applied when the slave device switches from the power-off state to the power-on state, and can also be applied during the process of powering on the slave device after powering off. For example, a problem occurs in the software system of the electronic device, causing the slave device to be powered off and then powered on, or a slave device may latch up (lanch-up), causing the slave device to be powered off and then powered on.
上面已对本申请实施例的器件识别方法进行了说明,下面对本申请实施例提供的执行上述器件识别方法的相关装置进行描述。本领域技术人员可以理解,方法和装置可以相互结合和引用,本申请实施例提供的相关装置可以执行上述器件识别方法中的步骤。The device identification method of the embodiment of the present application has been described above. The following describes the relevant device provided by the embodiment of the present application for performing the above device identification method. Those skilled in the art can understand that methods and devices can be combined and referenced with each other, and the relevant devices provided in the embodiments of the present application can perform the steps in the device identification method described above.
本申请实施例还提供了一种计算机可读存储介质。上述实施例中描述的方法可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。如果在软件中实现,则功能可以作为一个或多个指令或代码存储在计算机可读介质上或者在计算机可读介质上传输。计算机可读介质可以包括计算机存储介质和通信介质,还可以包括任何可以将计算机程序从一个地方传送到另一个地方的介质。存储介质可以是可由计算机访问的任何目标介质。An embodiment of the present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media may include computer storage media and communication media and may include any medium that can transfer a computer program from one place to another. The storage media can be any target media that can be accessed by the computer.
一种可能的实现方式中,计算机可读介质可以包括RAM,ROM,只读光盘(compact disc read-only memory,CD-ROM)或其它光盘存储器,磁盘存储器或其它磁存储设备,或目标于承载的任何其它介质或以指令或数据结构的形式存储所需的程序代码,并且可由计算机访问。而且,任何连接被适当地称为计算机可读介质。例如,如果使用同轴电缆,光纤电缆,双绞线,数字用户线(digital subscriber line,DSL)或无线技术 (如红外,无线电和微波)从网站,服务器或其它远程源传输软件,则同轴电缆,光纤电缆,双绞线,DSL或诸如红外,无线电和微波之类的无线技术包括在介质的定义中。如本文所使用的磁盘和光盘包括光盘,激光盘,光盘,数字通用光盘(digital versatile disc,DVD),软盘和蓝光盘,其中磁盘通常以磁性方式再现数据,而光盘利用激光光学地再现数据。上述的组合也应包括在计算机可读介质的范围内。In a possible implementation, the computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or may be targeted to carry any other medium or medium that stores the required program code in the form of instructions or data structures and accessible by a computer. Also, any connection is properly termed a computer-readable medium. For example, if you use coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies (such as infrared, radio, and microwave) to transmit software from a website, server, or other remote source, coaxial Cables, fiber optic cables, twisted pairs, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and optical disc, as used herein, includes optical disc, laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray disc, where disks typically reproduce data magnetically, while discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理单元以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理单元执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine, such that the instructions executed by the processing unit of the computer or other programmable data processing device produce a A device for realizing the functions specified in one process or multiple processes of the flowchart and/or one block or multiple blocks of the block diagram.
以上的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above specific embodiments further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention shall be included in the protection scope of the present invention.

Claims (15)

  1. 一种器件识别方法,其特征在于,应用于电子设备,所述电子设备包括主器件和从器件,所述主器件通过串行外设接口SPI总线与所述从器件连接,所述主器件存储有对应关系,所述对应关系包括从器件型号、第一地址、第一预设值、第二地址和第二预设值之间的关系,所述对应关系中任一从器件型号对应有一个第一地址、一个第一预设值、一个第二地址和一个第二预设值,所述方法包括:A device identification method, characterized in that it is applied to electronic equipment. The electronic equipment includes a master device and a slave device. The master device is connected to the slave device through a serial peripheral interface SPI bus. The master device stores There is a corresponding relationship. The corresponding relationship includes the relationship between the slave device model, the first address, the first preset value, the second address and the second preset value. In the corresponding relationship, any slave device model corresponds to a a first address, a first preset value, a second address and a second preset value, and the method includes:
    所述主器件基于第一从器件型号和所述对应关系读取所述从器件中寄存器的数值,得到所述第一从器件型号对应的第一值和所述第一从器件型号对应的第二值;The master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first value corresponding to the first slave device model and the first value corresponding to the first slave device model. binary;
    当所述主器件确定所述第一值与所述第一从器件型号对应的第一预设值相同,并且所述第二值与所述第一从器件型号对应的第二预设值相同时,所述主器件基于所述第一从器件型号配置所述从器件;When the master device determines that the first value is the same as the first preset value corresponding to the first slave device model, and the second value is consistent with the second preset value corresponding to the first slave device model. At the same time, the master device configures the slave device based on the first slave device model;
    在所述主器件基于所述第一从器件型号配置所述从器件之前,第三值为固定值,所述第三值为所述从器件中与所述第一从器件型号对应的第二地址对应的寄存器的数值。Before the master device configures the slave device based on the first slave device model, the third value is a fixed value, and the third value is the second slave device in the slave device corresponding to the first slave device model. The value of the register corresponding to the address.
  2. 根据权利要求1所述的方法,其特征在于,所述主器件基于第一从器件型号和所述对应关系读取所述从器件中寄存器的数值,得到所述第一从器件型号对应的第一值和所述第一从器件型号对应的第二值,包括:The method according to claim 1, characterized in that the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, and obtains the first slave device model corresponding to the first slave device model. A value and a second value corresponding to the first slave device model, including:
    所述主器件基于所述第一从器件型号对应的第一地址读取所述从器件中寄存器的数值,得到所述第一值;The master device reads the value of the register in the slave device based on the first address corresponding to the first slave device model to obtain the first value;
    所述主器件基于所述第一从器件型号对应的第二地址读取所述从器件中寄存器的数值,得到所述第二值。The master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model to obtain the second value.
  3. 根据权利要求2所述的方法,其特征在于,所述主器件基于所述第一从器件型号对应的第二地址读取所述从器件中寄存器的数值,得到所述第二值,包括:The method according to claim 2, characterized in that the master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model to obtain the second value, including:
    当所述主器件确定所述第一值与所述第一从器件型号对应的第一预设值相同时,所述主器件基于所述第一从器件型号对应的第二地址读取所述从器件中寄存器的数值,得到所述第二值。When the master device determines that the first value is the same as the first preset value corresponding to the first slave device model, the master device reads the first value based on the second address corresponding to the first slave device model. The second value is obtained from the value of the register in the device.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-3, characterized in that the method further includes:
    当所述主器件确定所述第一值与所述第一从器件型号对应的第一预设值不同,或者所述主器件确定所述第二值与所述第一从器件型号对应的第二预设值不同时,所述主器件基于第二从器件型号和所述对应关系读取从器件中寄存器的数值。When the master device determines that the first value is different from the first preset value corresponding to the first slave device model, or the master device determines that the second value is different from the first value corresponding to the first slave device model. When the two preset values are different, the master device reads the value of the register in the slave device based on the second slave device model and the corresponding relationship.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method of claim 4, further comprising:
    当所述主器件基于所述第二从器件型号和所述对应关系读取的从器件中寄存器的数值与所述第二从器件型号对应的第一预设值不同时,所述主器件基于预设型号配置所述从器件,所述预设型号为所述对应关系中任一个从器件型号;When the value of the register in the slave device read by the master device based on the second slave device model and the corresponding relationship is different from the first preset value corresponding to the second slave device model, the master device reads based on the second slave device model and the corresponding relationship. The preset model configures the slave device, and the preset model is any slave device model in the corresponding relationship;
    或者,当所述主器件基于所述第二从器件型号和所述对应关系读取的从器件中寄存器的数值与所述第二型号对应的第二预设值不同时,所述主器件基于所述预设型号配置所述从器件。Or, when the value of the register in the slave device read by the master device based on the second slave device model and the corresponding relationship is different from the second preset value corresponding to the second model, the master device reads based on the second slave device model and the corresponding relationship. The preset model configures the slave device.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述主器件基于所述第一从器件型号配置所述从器件,包括:The method according to any one of claims 1 to 5, characterized in that the master device configures the slave device based on the first slave device model, including:
    所述主器件将所述第一从器件型号对应的调整参数写入所述从器件的寄存器中。The master device writes the adjustment parameters corresponding to the first slave device model into the register of the slave device.
  7. 根据权利要求2-5任一项所述的方法,其特征在于,在所述主器件基于所述第一从器件型号对应的第二地址读取所述从器件中寄存器的数值之前,所述方法还包括:The method according to any one of claims 2 to 5, characterized in that, before the master device reads the value of the register in the slave device based on the second address corresponding to the first slave device model, the Methods also include:
    所述主器件控制所述从器件复位。The master device controls the slave device to reset.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述固定值不为零。The method according to any one of claims 1-7, characterized in that the fixed value is not zero.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述第二地址对应的寄存器包括:读值固定且未被读写操作过的控制寄存器。The method according to any one of claims 1 to 8, characterized in that the register corresponding to the second address includes: a control register whose reading value is fixed and has not been read or written.
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述主器件基于第一从器件型号和所述对应关系读取所述从器件中寄存器的数值之前,包括:The method according to any one of claims 1 to 9, characterized in that, before the master device reads the value of the register in the slave device based on the first slave device model and the corresponding relationship, it includes:
    所述主器件从第二状态切换为第一状态,所述第二状态为下电状态,所述第一状态为上电状态;The main device switches from a second state to a first state, the second state is a power-off state, and the first state is a power-on state;
    或者,所述主器件检测到所述从器件从所述第二状态切换为所述第一状态。Alternatively, the master device detects that the slave device switches from the second state to the first state.
  11. 根据权利要求1-10任一项所述的方法,其特征在于,所述对应关系以表格的形式存储在所述主器件中。The method according to any one of claims 1 to 10, characterized in that the corresponding relationship is stored in the main device in the form of a table.
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述主器件包括但不限于:处理器CPU或系统级芯片SOC、微控制器MCU、微处理器MPU或可编程片上系统SOPC;The method according to any one of claims 1 to 11, characterized in that the main device includes but is not limited to: processor CPU or system-on-chip SOC, microcontroller MCU, microprocessor MPU or programmable system on chip SOPC;
    所述从器件包括但不限于:传感器、电池、天线、移动通信模块,无线通信模块,音频模块、扬声器、受话器、麦克风、耳机、按键、马达、指示器、摄像头、显示屏,以及用户标识模块。The slave devices include but are not limited to: sensors, batteries, antennas, mobile communication modules, wireless communication modules, audio modules, speakers, receivers, microphones, headphones, buttons, motors, indicators, cameras, display screens, and user identification modules .
  13. 一种电子设备,其特征在于,包括:处理器和存储器;An electronic device, characterized by including: a processor and a memory;
    所述存储器存储计算机执行指令;The memory stores computer execution instructions;
    所述处理器执行所述存储器存储的计算机执行指令,使得所述处理器执行如权利要求1-12中任一项所述的方法。The processor executes computer-executable instructions stored in the memory, so that the processor executes the method according to any one of claims 1-12.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被运行时,实现如权利要求1-12中任一项所述的方法。A computer-readable storage medium, characterized in that computer programs or instructions are stored in the computer-readable storage medium. When the computer programs or instructions are run, the implementation of any one of claims 1-12 is achieved. method described.
  15. 一种计算机程序产品,包括计算机程序或指令,其特征在于,所述计算机程序或指令被处理器执行时,实现如权利要求1-12中任一项所述的方法。A computer program product, including a computer program or instructions, characterized in that when the computer program or instructions are executed by a processor, the method according to any one of claims 1-12 is implemented.
PCT/CN2023/071238 2022-04-12 2023-01-09 Device identification method and related apparatus WO2023197709A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210380036.1A CN114780029B (en) 2022-04-12 2022-04-12 Device identification method and related device
CN202210380036.1 2022-04-12

Publications (1)

Publication Number Publication Date
WO2023197709A1 true WO2023197709A1 (en) 2023-10-19

Family

ID=82429638

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/071238 WO2023197709A1 (en) 2022-04-12 2023-01-09 Device identification method and related apparatus

Country Status (2)

Country Link
CN (2) CN116909474A (en)
WO (1) WO2023197709A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116909474A (en) * 2022-04-12 2023-10-20 荣耀终端有限公司 Device identification method and related device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1767544A (en) * 2004-10-28 2006-05-03 株式会社三协精机制作所 Slave device in information processing system, operation control program for slave device, and operation control method for slave device
CN1964526A (en) * 2005-11-09 2007-05-16 中兴通讯股份有限公司 A method for hardware drive program of intelligent loading mobile phone
CN102289415A (en) * 2010-06-15 2011-12-21 英特尔移动通信技术有限公司 Method and apparatus of identifying devices on a bus and apparatus
KR20150114826A (en) * 2014-04-02 2015-10-13 엘지전자 주식회사 Mobile terminal and method for controlling the same
CN106982246A (en) * 2017-02-21 2017-07-25 普奥云信息科技(北京)有限公司 Smart machine
CN110958602A (en) * 2019-11-14 2020-04-03 深圳奇未智能科技有限公司 Firmware compatibility method and device for Bluetooth equipment
CN114780029A (en) * 2022-04-12 2022-07-22 荣耀终端有限公司 Device identification method and related device

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4313162A (en) * 1979-12-14 1982-01-26 Burroughs Corporation I/O Subsystem using data link processors
US5938742A (en) * 1995-08-18 1999-08-17 General Magic, Inc. Method for configuring an intelligent low power serial bus
EP0901081B1 (en) * 1997-07-08 2010-04-07 Texas Instruments Inc. A digital signal processor with peripheral devices and external interfaces
US8596529B1 (en) * 2001-03-26 2013-12-03 Usa Technologies, Inc. Interactive interface effectuated vending
CN201063161Y (en) * 2007-06-08 2008-05-21 威盛电子股份有限公司 Primary device for serial peripheral interface
US7425843B1 (en) * 2007-08-07 2008-09-16 Xilinx, Inc. Programmable logic device multi-boot state machine for serial peripheral interface (SPI) programmable read only memory (PROM)
DE102010029349A1 (en) * 2010-05-27 2011-12-01 Robert Bosch Gmbh Control unit for exchanging data with a peripheral unit, peripheral unit, and method for data exchange
US9547607B2 (en) * 2013-06-27 2017-01-17 Microsoft Technology Licensing, Llc Brokering application access for peripheral devices
KR102128406B1 (en) * 2014-09-26 2020-07-10 삼성전자주식회사 Storage device and operating emthod of storage device
CN105388805B (en) * 2015-11-01 2018-04-06 四川泛华航空仪表电器有限公司 Measurement and Control System based on spi bus
CN108052094B (en) * 2017-12-20 2021-01-15 深圳市英威腾电气股份有限公司 Expansion card identification method and device and frequency converter
US10360164B1 (en) * 2018-01-19 2019-07-23 Microchip Technology Incorporated Direct memory access adapter
KR20210045241A (en) * 2019-10-16 2021-04-26 삼성전자주식회사 Electronic device and method for sharing voice command thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1767544A (en) * 2004-10-28 2006-05-03 株式会社三协精机制作所 Slave device in information processing system, operation control program for slave device, and operation control method for slave device
CN1964526A (en) * 2005-11-09 2007-05-16 中兴通讯股份有限公司 A method for hardware drive program of intelligent loading mobile phone
CN102289415A (en) * 2010-06-15 2011-12-21 英特尔移动通信技术有限公司 Method and apparatus of identifying devices on a bus and apparatus
KR20150114826A (en) * 2014-04-02 2015-10-13 엘지전자 주식회사 Mobile terminal and method for controlling the same
CN106982246A (en) * 2017-02-21 2017-07-25 普奥云信息科技(北京)有限公司 Smart machine
CN110958602A (en) * 2019-11-14 2020-04-03 深圳奇未智能科技有限公司 Firmware compatibility method and device for Bluetooth equipment
CN114780029A (en) * 2022-04-12 2022-07-22 荣耀终端有限公司 Device identification method and related device

Also Published As

Publication number Publication date
CN116909474A (en) 2023-10-20
CN114780029A (en) 2022-07-22
CN114780029B (en) 2023-05-09

Similar Documents

Publication Publication Date Title
US20220086554A1 (en) Method of controlling charging level in audio device that is connectable to electronic device
US10057673B2 (en) Electronic device and operating method thereof
KR102511514B1 (en) Device and method for fast charging using various charge method
CN110347269B (en) Empty mouse mode realization method and related equipment
JP7403641B2 (en) Touch screens, electronic devices, and display control methods
JP2022541207A (en) Voice activated method and electronic device
WO2021185105A1 (en) Method for switching between sim card and esim card, and electronic device
WO2021063311A1 (en) Display control method for electronic device having foldable screen, and electronic device
CN110687998A (en) Application management method and device
WO2021052170A1 (en) Motor vibration control method and electronic device
CN113728295A (en) Screen control method, device, equipment and storage medium
CN111865646A (en) Terminal upgrading method and related device
WO2023197709A1 (en) Device identification method and related apparatus
CN113448482A (en) Sliding response control method and device of touch screen and electronic equipment
CN111492678B (en) File transmission method and electronic equipment
WO2022089000A1 (en) File system check method, electronic device, and computer readable storage medium
CN115589051B (en) Charging method and terminal equipment
WO2022037725A1 (en) System service recovery method and apparatus, and electronic device
CN113901485B (en) Application program loading method, electronic device and storage medium
CN110806994B (en) Signal transmission method and device
CN114116610A (en) Method, device, electronic equipment and medium for acquiring storage information
CN114089902A (en) Gesture interaction method and device and terminal equipment
CN114690849A (en) Clock skew determination method, device and storage medium
WO2021129453A1 (en) Screenshot method and related device
CN114258044A (en) Standby method, system and terminal equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23787358

Country of ref document: EP

Kind code of ref document: A1