Vehicle machine alarm sound playing system and method based on external Flash
By using a combination of MCU, DSP chip and external Flash chip in the vehicle system, and by utilizing the multiplexing interface and switching of the DSP chip, the problem of limited MCU storage space and interface resources in traditional solutions is solved, achieving efficient alarm sound data reading and playback, and reducing hardware costs and system complexity.
Patent Information
- Application Number
- CN202511095924.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-18
AI Technical Summary
Traditional vehicle alarm sound playback solutions occupy MCU storage space and interface resources, leading to resource shortages when the number of audio files increases, making it difficult to efficiently read alarm sound data.
The system employs a combination of MCU, DSP chip, and external Flash chip. Audio file storage and playback are achieved through the multiplexing interface and switching switch of the DSP chip. The interface mode is switched by configuring the registers of the DSP chip, and the physical connection line is switched by the switching switch controlled by the MCU to achieve switching between SPI and I2S modes.
It saves MCU storage space, optimizes interface resources, enables efficient reading and playback of alarm sound data, and reduces hardware costs and system complexity.
Smart Images

Figure CN120977054A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of car machine system, in particular to a car machine alarm sound playing system and method based on external Flash. BACKGROUND
[0002] With the diversification of car machine functions, the types of alarm sound and prompt sound are increasing, and the traditional car machine alarm sound playing scheme has obvious defects.
[0003] Traditional scheme 1: the audio file is stored in the MCU built-in Flash, the MCU configures the DSP chip through the SPI interface, and sends the audio data to the DSP chip for playing through the I2S interface. This scheme occupies the MCU storage space, and needs to occupy the I2S interface of the MCU, when the audio file increases, the problem of insufficient MCU storage space is easy to appear.
[0004] Traditional scheme 2: the audio file is stored in the external Flash, the MCU configures the DSP chip through the first SPI interface, reads the audio data from the external Flash through the second SPI interface, and sends it to the DSP chip for playing through the I2S interface. This scheme needs to occupy two SPI interfaces and an I2S interface of the MCU, the interface resources are scarce, which is not conducive to the integration and miniaturization of the car machine system. SUMMARY
[0005] Therefore, the purpose of the present application is to provide a car machine alarm sound playing system and method based on external Flash, which can save MCU storage space, optimize interface resources, and realize efficient reading of alarm sound data.
[0006] The car machine alarm sound playing system based on external Flash provided by the embodiment of the present application is characterized in that it comprises an MCU, a DSP chip, an external Flash chip and a switch, the MCU is connected with the DSP chip through an MCU-DSP SPI interface, and the MCU is an SPI host, and the DSP chip is an SPI slave; The external Flash chip is connected with the DSP chip through a multiplexing interface of the DSP chip, the multiplexing interface is configured to be switched to a DSP-Flash SPI interface or an I2S interface through a register; The switch is used to switch the physical connection line between the external Flash chip and the DSP chip according to the function of the multiplexing interface, and the external Flash chip stores the audio file of the car machine alarm sound.
[0007] In some embodiments, the multiplexing interface of the DSP chip is switched to a DSP-Flash SPI interface or an I2S interface by configuring a 0x0204 register of the DSP chip. When the 0x0204 register is configured as 0x0F, the multiplexing interface of the DSP chip is switched to an I2S interface; and when the 0x0204 register is configured as 0x00, the multiplexing interface of the DSP chip is switched to a DSP-Flash SPI interface.
[0008] In some embodiments, the switching switch is a dual-channel analog switching switch chip, and a control end of the switching switch is connected to a GPIO interface of the MCU through a triode. When the GPIO interface outputs a high level, the switching switch forms a physical connection path between the external Flash chip and a DSP-Flash SPI interface currently worked by the DSP chip; and when the GPIO interface outputs a low level, the switching switch forms a physical connection path between the external Flash chip and an I2S interface currently worked by the DSP chip.
[0009] In some embodiments, a communication rate of the MCU-DSP SPI interface is 10 MHz, and the MCU-DSP SPI interface includes a chip selection signal line, a data transmission line, a data reception line, and a clock line.
[0010] In some embodiments, a vehicle machine alarm sound playing method based on an external Flash is also provided, and the method is applied to any one of the vehicle machine alarm sound playing systems, and the method includes the following steps: In response to a first configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the DSP chip is configured as an I2S interface. The switching switch is switched to an I2S mode by the MCU, and a physical connection path between the external Flash chip and an I2S interface currently worked by the DSP chip is formed. Based on the DSP chip, an audio file of a vehicle machine alarm sound is read from the external Flash chip through the I2S interface, and the audio file is output to a power amplifier for playing.
[0011] In some embodiments, the method further includes the following steps: In response to an entering SPI transparent mode command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the MCU-DSP SPI interface is connected to the multiplexing interface of the DSP chip. In response to a second configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the DSP chip is configured as a DSP-Flash SPI interface; The MCU controls the switch to switch to the SPI mode, and the external Flash chip and the DSP-Flash SPI interface currently operated by the DSP chip are physically connected to form a communication path, so that the MCU and the external Flash chip establish SPI communication. Based on the SPI communication mode of the MCU, the audio file stored in the external Flash chip is read and written.
[0012] In some embodiments, after the MCU reads and writes the audio file stored in the external Flash chip based on the SPI communication mode, the following steps are included: In response to the MCU sending an exit SPI transparent mode command to the DSP chip through the MCU-DSP SPI interface, the MCU-DSP SPI interface and the multiplexing interface of the DSP chip are disconnected.
[0013] In some embodiments, the MCU sends 0xDE 0x84 0x72 0x82 four-byte data to the DSP chip through the MCU-DSP SPI interface as an SPI transparent mode command; the MCU sends 0xDE 0x0000 0x00 four-byte data to the DSP chip through the MCU-DSP SPI interface as an exit SPI transparent mode command.
[0014] In some embodiments, an electronic device is also provided, including a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and the machine readable instructions executed by the processor perform the steps of any one of the above-mentioned vehicle alarm sound playing methods based on external Flash.
[0015] In some embodiments, a computer readable storage medium is also provided, which stores a computer program, and the computer program is executed by the processor to perform the steps of any one of the above-mentioned vehicle alarm sound playing methods based on external Flash.
[0016] The application discloses a vehicle machine alarm sound playing system and method based on an external Flash. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.
[0018] Figure 1 The structure diagram of the vehicle machine alarm sound playing system based on the external Flash is shown; Figure 2 The pin connection diagram of the DSP chip is shown; Figure 3 The circuit connection diagram of the switching switch is shown; Figure 4 The flow chart of the vehicle machine alarm sound playing method based on the external Flash is shown; Figure 5 Fig. 1 shows an interface connection diagram between the MCU, the DSP chip and the external Flash chip when the embodiment of the application reads the audio file of the car machine alarm sound; Figure 6 Fig. 2 shows a flowchart of the read-write operation of the audio file stored in the external Flash chip by the MCU in the manner of SPI communication; Figure 7 Fig. 3 shows an interface connection diagram between the MCU, the DSP chip and the external Flash chip when the embodiment of the application performs the read-write operation of the audio file stored in the external Flash chip; Figure 8 Fig. 4 shows a structure diagram of the electronic device according to the embodiment of the application. DETAILED DESCRIPTION
[0019] To make the objectives, technical solutions and advantages of the embodiments of the application clearer, the technical solutions in the embodiments of the application will be described below in detail with reference to the drawings in the embodiments of the application. It should be understood that the drawings in the application are only used for the purpose of description and illustration, and do not limit the scope of protection of the application. In addition, it should be understood that the schematic drawings are not drawn according to the actual proportions. The flowchart shows the operations implemented according to some embodiments of the application. It should be understood that the operations of the flowchart can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowchart or removed from the flowchart under the guidance of the content of the application by those skilled in the art.
[0020] In addition, the described embodiments are only some of the embodiments of the application, not all the embodiments. The components of the embodiments of the application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the application provided in the drawings is not intended to limit the scope of the claimed application, but only represents selected embodiments of the application. Based on the embodiments of the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.
[0021] It should be noted that the term "comprising" will be used in the embodiments of the application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0022] In view of the technical problems proposed in the background art, the application provides a car machine alarm sound playing system and method based on external Flash, which can save MCU storage space, optimize interface resources and realize efficient reading of alarm sound data.
[0023] Referring to the description attached Figure 1 The application provides a vehicle-machine alarm sound playing system based on an external Flash, which comprises an MCU, a DSP chip, an external Flash chip and a switch. The MCU is connected with the DSP chip through an MCU-DSP SPI interface, and the MCU is an SPI host and the DSP chip is an SPI slave. In an embodiment, referring to the description attached Figure 2 The model of the DSP chip is AK7739, and the MCU-DSP SPI interface for realizing the connection between the MCU and the DSP chip comprises four key signal lines. Among them, MCU_DSP_SPI_CS is an SPI chip selection signal line (low level effective), and the MCU controls the start and stop of communication with the DSP chip through the signal line (selected when the DSP chip is pulled low, and disconnected when the high level is high). MCU_DSP_SPI_MOSI is an SPI data transmission line (host output, slave input), and the MCU sends configuration commands (such as register configuration, enter / exit SPI transparent mode commands) to the DSP chip through the signal line. MCU_DSP_SPI_MISO is an SPI data receiving line (host input, slave output), and the DSP chip returns response data (such as status information, Flash version verification result, etc.) to the MCU through the signal line. MCU_DSP_SPI_CLK is an SPI clock signal line, and the clock signal is output by the MCU to synchronize the data transmission rhythm of both sides. The communication rate is fixed at 10MHz, and the SPI mode is adopted (low level when the clock is idle, and data is sampled on the rising edge of the clock).
[0024] The external Flash chip is connected with the DSP chip through a multiplexing interface of the DSP chip, and the multiplexing interface is switched to a DSP-Flash SPI interface or an I2S interface through register configuration. In the application, 18th pin (ESDI / SDIN5), 21st pin (ECSO / SDOUT5), 22nd pin (ESDO / LRCK5) and 23rd pin (ESCLK / BICK5) of the DSP chip are multifunctional pins, which are connected with 2nd pin (SO), 1st pin (CS), 5th pin (SI) and 6th pin (SCLK) of the external Flash chip as multiplexing pins. The MCU switches the multiplexing interface of the DSP chip to the DSP-Flash SPI interface or the I2S interface by configuring 0x0204 register of the DSP chip. Specifically, when the 0x0204 register is configured as 0x0F, the multiplexing interface of the DSP chip is switched to the I2S interface, at this time, the 18th pin is used as an I2S data receiving pin, the 21st pin is used as an I2S data sending pin, the 22nd pin is used as an I2S channel clock pin, and the 23rd pin is used as an I2S clock pin; when the 0x0204 register is configured as 0x00, the multiplexing interface of the DSP chip is switched to the DSP-Flash SPI interface, at this time, the 18th pin is used as an SPI data input pin, the 21st pin is used as an SPI chip selection output pin, the 22nd pin is used as an SPI data output pin, and the 23rd pin is used as an SPI clock pin. Thus, through the function multiplexing of the four pins of the DSP chip, independent interfaces for the SPI and the I2S are avoided to be designed, and the chip pin and the circuit board wiring space are saved.
[0025] The switch is used for switching the physical connection line between the external Flash chip and the DSP chip according to the function of the multiplexing interface. In an embodiment, referring to the description accompanying drawings Figure 3, the switch adopts a double-channel analog switch with a model number TS5A23157, and the external Flash chip has a model number MX25L3233FM21-08G, wherein the double-channel analog switch serves as a physical path switcher and internally includes two groups of independent single-pole double-throw switches (COM1-NO1-NC1, COM2-NO2-NC2), can switch the connection between the common end (COM) and the normally open end (NO) or the normally closed end (NC) through a control signal, and adapts to the path requirements of the SPI mode and the I2S mode. Moreover, the control end of the double-channel analog switch is connected with the GPIO interface (MCU_DSP_FLASH_SW) of the MCU through a triode. When the MCU outputs a high level, the triode is turned on, the IN1 and IN2 pins of the switch are pulled low (low level), according to the characteristics of TS5A23157, the COM end is connected with the NC end (normally closed path), so as to switch to the SPI mode, that is, to form a physical connection path between the external Flash chip and the DSP-Flash SPI interface currently working with the DSP chip. When the MCU outputs a low level, the triode is cut off, the IN1 and IN2 pins of the switch are pulled high (high level), the COM end is connected with the NO end (normally open path), so as to switch to the I2S mode, that is, to form a physical connection path between the external Flash chip and the I2S interface currently working with the DSP chip. Thus, through the hardware path switching, the problem of different SPI and I2S protocol signal definitions (such as the pin correspondence relationship of the chip selection and the clock signal) is solved, and it is ensured that the connection between the external Flash chip and the DSP chip in the two modes matches the current protocol. Moreover, only one switch and a simple triode circuit are used to realize reliable switching of the two paths, avoid complex multi-interface wiring, and reduce the hardware cost.
[0026] The characteristics and working principle of TS5A23157 should be known to those skilled in the art, and are not the core point of the present application, and are not described here. Moreover, the audio file is stored in the external Flash chip and is connected to the DSP chip, and the MCU needs to access the audio file version in the external Flash chip or upgrade the audio file.
[0027] Further, referring to the drawings attached to the specification Figure 4 The present application also provides a vehicle machine alarm sound playing method based on an external Flash, which is applied to the vehicle machine alarm sound playing system and includes the following steps. S1, in response to a first configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, configure the multiplexing interface of the DSP chip as an I2S interface; S2, switching to I2S mode by the MCU to control the switch, forming a physical connection path between the external Flash chip and the I2S interface currently working with the DSP chip; S3, based on the DSP chip reading the audio file of the car alarm sound from the external Flash chip through the I2S interface, and outputting to the power amplifier to play.
[0028] Specifically, in step S1, the MCU sends a first configuration command of writing configuration value 0x0F to 0x0204 register to the DSP chip through standard SPI, which switches the multiplexing interface (18 pin, 21 pin, 22 pin, 23 pin) of the DSP chip from DSP-Flash SPI interface to I2S interface, that is, 18 pin changes from ESDI of SPI to SDIN5 of I2S; 21 pin changes from ECSO of SPI to SDOUT5 of I2S; 22 pin changes from ESDO of SPI to LRCK5 of I2S; 23 pin changes from ESCLK of SPI to BICK5 of I2S, which prepares for subsequent direct reading of audio data from external Flash chip.
[0029] In step S2, referring to the description of the accompanying drawings Figure 5 , the MCU outputs a low-level signal through the GPIO port (MCU_DSP_FLASH_SW) to make the control switch switch the external Flash chip from the original SPI communication path to the I2S path, realize the physical disconnection of the external Flash chip and the SPI interface of the MCU, and only connect with the I2S interface of the DSP chip directly, ensuring the independence of data transmission.
[0030] In step S3, the DSP chip automatically adjusts the playing parameters according to the preset logic (such as alarm type, volume level), independently completes the reading and playing of audio data, without the intervention of MCU, and realizes low-delay response.
[0031] In addition, referring to the description of the accompanying drawings Figure 6 , the method further comprises the following steps: S4, in response to the entering SPI transparent mode command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the MCU-DSP SPI interface is connected with the DSP chip; S5, in response to the second configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the DSP chip is configured as DSP-Flash SPI interface; S6, switching the switch controlled by the MCU to the SPI mode, to form a physical connection path between the external Flash chip and the DSP-Flash SPI interface of the currently working DSP chip, so as to establish SPI communication between the MCU and the external Flash chip; S7, reading and writing the audio file stored in the external Flash chip by the MCU in the SPI communication mode.
[0032] Specifically, in step S4, the DSP chip is configured to the transparent mode, so that the SPI interface (DSP-Flash SPI interface, connected to the external Flash chip) in the DSP chip is directly connected to the SPI interface (MCU-DSP SPI interface) of the MCU, forming a data channel between the MCU, the DSP chip and the external Flash chip. Here, the MCU sends an SPI transparent mode entering command to the DSP chip through the standard SPI protocol, such as sending four bytes of data 0xDE 0x84 0x72 0x82 to the DSP chip through the MCU-DSP SPI interface as the SPI transparent mode entering command. After receiving the SPI transparent mode entering command, the DSP chip activates the SPI Through Mode (SPI transparent mode) and configures the internal SPI controller to the transparent transmission state.
[0033] In step S5, the MCU sends a second configuration command to write the configuration value 0x00 to the 0x0204 register to the DSP chip through the standard SPI protocol, which switches the multiplexing interface (18 pin, 21 pin, 22 pin, 23 pin) of the DSP chip from the I2S interface to the DSP-Flash SPI interface, i.e. the 18 pin changes from the I2S SDIN5 to the SPI ESDI; the 21 pin changes from the I2S SDOUT5 to the SPI ECSO; the 22 pin changes from the I2S LRCK5 to the SPI ESDO; and the 23 pin changes from the I2S BICK5 to the SPI ESCLK.
[0034] In step S6, referring to the description of the accompanying drawings Figure 7 The MCU outputs a high-level signal through the GPIO port (MCU_DSP_FLASH_SW) to make the control switch switch the external Flash chip from the original I2S path to the SPI communication path, realizing the direct control of the MCU to the external Flash chip.
[0035] In step S7, the MCU directly accesses the external Flash chip for data management by using a transparent channel, without the participation of the DSP chip. For example, the MCU sends a Read Data command (0x03) to read the version number of an audio file stored in a specific address of the external Flash chip, compares the version number with the latest version number stored locally, and determines whether to upgrade. The MCU sends a Write Enable command (0x06) to enable the external Flash chip to write.
[0036] In addition, after the MCU performs the read-write operation on the audio file stored in the external Flash chip based on the SPI communication mode, the MCU-DSP SPI interface is disconnected from the multiplexed interface of the DSP chip in response to the exit SPI transparent mode command sent by the MCU to the DSP chip through the MCU-DSP SPI interface. Here, the MCU sends four bytes of 0xDE 0x0000 0x00 data to the DSP chip as the exit SPI transparent mode command through the MCU-DSP SPI interface, so as to close the transparent mode, release the DSP chip resources, and restore the normal working state of the system, such as switching to the I2S interface mode again, so as to directly play the alarm sound from the external Flash chip subsequently, avoid the interference of the SPI transparent mode on the audio playing process, and further ensure the orderly switching of file management and audio playing.
[0037] It can be seen that the vehicle machine alarm sound playing system and method based on an external Flash provided in the application store the audio file in the external Flash chip, without occupying the built-in storage space of the MCU, solving the problem of insufficient storage of the MCU caused by the increase in the types of alarm sounds in the traditional scheme. Meanwhile, the MCU can configure the DSP chip and perform the read-write operation (such as version checking and audio upgrading) on the external Flash chip in the SPI Through Mode only through one SPI interface, avoiding the occupation of multiple SPI interfaces in the traditional scheme, reducing the number of hardware interfaces, and reducing the system wiring complexity and cost. In the application, the register configuration (interface multiplexing) of the DSP chip and the hardware channel switching of the switching switch can be used to flexibly switch between the audio playing mode (I2S interface) and the Flash read-write mode (SPI interface): the DSP chip directly reads the audio from the external Flash chip during playing, and the response is fast; the MCU efficiently operates the external Flash chip in the transparent mode during upgrading, and the two modes do not interfere with each other, improving the stability and flexibility of the system.
[0038] Based on the same concept of the application, as described in the specification Figure 8As shown, the electronic device 800 provided by the embodiment of the present application includes at least one processor 801, at least one network interface 804 or other user interface 803, a memory 805, and at least one communication bus 802. The communication bus 802 is used to realize the connection and communication between the components. The electronic device 800 can optionally include a user interface 803, including a display (for example, a touch screen, an LCD, a CRT, holographic imaging (Holographic) or a projector, etc.), a keyboard or a clicking device (for example, a mouse, a trackball, a touchpad or a touch screen, etc.).
[0039] The memory 805 can include read-only memory and random access memory, and provide instructions and data for the processor 801. A part of the memory 805 can also include a non-volatile random access memory (NVRAM).
[0040] In some embodiments, the memory 805 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof: An operating system 8051, including various system programs, is used to realize various basic services and process hardware-based tasks; An application module 8052, including various application programs, such as a desktop (launcher), a media player (MediaPlayer), a browser (Browser), etc., is used to realize various application services.
[0041] In the embodiment of the present application, the processor 801 is used to execute the steps of the method for playing an alarm sound based on an external Flash by calling the programs or instructions stored in the memory 805.
[0042] The present application also provides a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, the steps of the method for playing an alarm sound based on an external Flash are executed.
[0043] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, the MCU storage space can be saved, the interface resources can be optimized, and the efficient reading of alarm sound data can be realized.
[0044] In the embodiments of the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. The embodiments described above are merely exemplary, for example, the division of units is only a logical function division, and there can be another division manner in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between units can be indirect coupling or communication connection through some interfaces, and can be electrical, mechanical or other forms.
[0045] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0046] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit.
[0047] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or partly, or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various other media that can store program codes.
[0048] Finally, it should be noted that the above examples are merely specific embodiments of the present application, and are used to illustrate the technical solutions of the present application, but not to limit the same. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing examples, it should be understood by those skilled in the art that any person skilled in the art can make modifications or easily think of changes to the technical solutions recorded in the foregoing examples, or make equivalent replacements to some of the technical features, within the technical scope disclosed by the present application. The modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. All of them should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A vehicle alarm sound playback system based on external Flash memory, characterized in that, It includes an MCU, a DSP chip, an external Flash chip, and a switching switch. The MCU is connected to the DSP chip via an MCU-DSP SPI interface, and the MCU is the SPI master, while the DSP chip is the SPI slave. The external Flash chip is connected to the DSP chip through a multiplexed interface of the DSP chip. The multiplexed interface can be switched to a DSP-Flash SPI interface or an I2S interface through register configuration. The switching switch is used to switch the physical connection line between the external Flash chip and the DSP chip according to the function of the multiplexing interface, and the external Flash chip stores the audio file of the vehicle alarm sound.
2. The vehicle alarm sound playback system based on external Flash according to claim 1, characterized in that, in, The multiplexing interface of the DSP chip can be switched to either the DSP-Flash SPI interface or the I2S interface by configuring the 0x0204 register of the DSP chip. When register 0x0204 is configured as 0x0F, the multiplexing interface of the DSP chip is switched to the I2S interface; when register 0x0204 is configured as 0x00, the multiplexing interface of the DSP chip is switched to the DSP-Flash SPI interface.
3. The vehicle alarm sound playback system based on external Flash according to claim 1, characterized in that, The switching switch uses a dual-channel analog switching switch chip, and its control terminal is connected to the GPIO interface of the MCU through a transistor. When the GPIO interface outputs a high level, the switch establishes a physical connection between the external Flash chip and the DSP-Flash SPI interface currently operating on the DSP chip; when the GPIO interface outputs a low level, it establishes a physical connection between the external Flash chip and the I2S interface currently operating on the DSP chip.
4. The vehicle alarm sound playback system based on external Flash according to claim 1, characterized in that, The MCU-DSP SPI interface has a communication rate of 10MHz and includes a chip select signal line, a data transmit line, a data receive line, and a clock line.
5. A method for playing vehicle alarm sounds based on external Flash memory, characterized in that, Applied to the vehicle alarm sound playback system according to any one of claims 1-4, the method includes the following steps: In response to the first configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the DSP chip is configured as an I2S interface; The MCU controls the switch to switch to I2S mode, forming a physical connection path between the external Flash chip and the I2S interface currently operating on the DSP chip. The DSP chip reads the audio file of the vehicle alarm tone from the external Flash chip through the I2S interface and outputs it to the amplifier for playback.
6. The method for playing vehicle alarm sounds based on external Flash memory according to claim 5, characterized in that, The method further includes the following steps: In response to the command sent by the MCU to the DSP chip via the MCU-DSP SPI interface to enter SPI pass-through mode, the MCU-DSP SPI interface is connected to the multiplexed interface of the DSP chip; In response to the second configuration command sent by the MCU to the DSP chip through the MCU-DSP SPI interface, the multiplexing interface of the DSP chip is configured as the DSP-Flash SPI interface; The MCU controls the switch to switch to SPI mode, forming a physical connection path between the external Flash chip and the DSP-Flash SPI interface currently operating on the DSP chip, so that the MCU and the external Flash chip can establish SPI communication. The MCU uses SPI communication to read and write audio files stored in the external Flash chip.
7. The method for playing vehicle alarm sounds based on external Flash memory according to claim 6, characterized in that, After the MCU performs read and write operations on the audio files stored in the external Flash chip using SPI communication, the process includes the following steps: In response to the command sent by the MCU to the DSP chip via the MCU-DSP SPI interface to exit SPI pass-through mode, the MCU-DSP SPI interface is disconnected from the multiplexed interface of the DSP chip.
8. The method for playing vehicle alarm sounds based on external Flash memory according to claim 7, characterized in that, in, The MCU sends four bytes of data (0xDE 0x84 0x72 0x82) to the DSP chip via the MCU-DSP SPI interface as a command to enter SPI pass-through mode; the MCU sends four bytes of data (0xDE 0x0000 0x00) to the DSP chip via the MCU-DSP SPI interface as a command to exit SPI pass-through mode.
9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of a vehicle alarm sound playback method based on external Flash as described in any one of claims 5 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of a vehicle alarm sound playback method based on external Flash as described in any one of claims 5 to 8.