Search

CN-121996497-A - Method for realizing black box function based on DSP 28335 external expansion SRAM and FLASH

CN121996497ACN 121996497 ACN121996497 ACN 121996497ACN-121996497-A

Abstract

The disclosure relates to a method, a device, an electronic device and a storage medium for realizing a black box function based on a DSP28335 external SRAM and a FLASH. The method comprises the steps of connecting a static random access memory SRAM and a FLASH memory FLASH for a DSP28335 chip in an outward expansion mode through XINTF interfaces, recording preset operation data of the DSP28335 chip by the outward expansion SRAM based on a preset outward expansion SRAM data recording flow, storing the data recorded by the outward expansion SRAM by the outward expansion FLASH based on a preset outward expansion FLASH data storing flow, and reading the data recorded by the outward expansion SRAM by the outward expansion FLASH based on a preset outward expansion FLASH data reading flow. The method and the device realize the operation data record of a period of time before the fault by expanding the SRAM and the FLASH based on the DSP28335, and are favorable for subsequent data analysis and abnormal problem positioning.

Inventors

  • XIE WENBIN
  • CHEN HAO
  • FENG LING
  • JI JINHU

Assignees

  • 北京机械设备研究所

Dates

Publication Date
20260508
Application Date
20251205

Claims (10)

  1. 1. A method for implementing a black box function based on DSP28335 FLASH SRAM and FLASH, the method comprising: A static random access memory SRAM and a FLASH memory FLASH are connected for the DSP28335 chip through XINTF interface expansion; Recording preset operation data of the DSP28335 chip by using the external expansion SRAM based on a preset external expansion SRAM data recording flow; The method comprises the steps that the FLASH of the external expansion is stored on the basis of a preset FLASH data storage flow of the external expansion, so that the data recorded by the SRAM of the external expansion are stored; and reading the data recorded by the external SRAM by the external FLASH based on a preset external FLASH data reading flow.
  2. 2. The method of claim 1, wherein the method further comprises: 20 address lines and 4 GPIO ports of the DSP28335 chip are used as address lines XA20-XA23 of the FLASH chip which is expanded.
  3. 3. The method of claim 1, wherein the preset operating data is voltage, current and temperature data of the DSP28335 chip.
  4. 4. The method of claim 1, wherein the method further comprises: XRD pins of the DSP28335 chip are respectively connected with read permission control signals OE# of the FLASH and SRAM; The XWE0 pin of the DSP28335 chip is respectively connected with write protection control signals WE# of the FLASH memory and the SRAM; the GPIO pin of DSP28335 chip is connected with the FLASH RY/BY that expands outward, allow to operate FLASH when this pin is high level.
  5. 5. The method of claim 1, wherein the pre-set flared SRAM data recording flow in the method further comprises: setting total number of SRAM record data, wherein the total number comprises member number and total group number in each group; process 102, initializing SRAM data to 0; If serious fault occurs, F28335 does not update data to SRAM any more, otherwise, the key data is continuously updated; step 103, if the fault exists, the SRAM is not enabled any more, and the data is stopped to be updated; 104, if no fault exists, recording one group of data each time, accumulating addresses, and preparing for recording the next group of data; a step 105 of starting recording a new set of data according to the address of the step 104; The condition judgment 102 is that if the data recorded in the SRAM exceeds the set total value, the old data is required to be updated according to the first-in first-out principle; A flow 106, updating the original recorded old data in sequence according to the first-in first-out principle; The process 107, judging that the data recorded by the SRAM does not exceed the total number, accumulating the addresses, and waiting for the next group of parameter updating; Flow 108. Program execution cycle arrives, recording a new set of data.
  6. 6. The method of claim 1, wherein the pre-set FLASH data save procedure further comprises: the method comprises the following steps of (1) reading the total times of historical faults from FLASH; the method comprises the steps of 202, selecting a failure frequency accumulation storage address, placing the failure frequency accumulation storage address on a first page of FLASH, and selecting a sector 0; the process 203 is to erase sector 0, and the FLASH needs to be erased before each writing; the process 204 is that writing FLASH after adding 1 to the total number of times of the history faults, and completing the storage of the total number of times of the history faults; A flow 205, selecting a new fault data storage start address according to the total number of the historical faults read in the flow 201 plus 1; process 206, process 205 starts erasing the corresponding sector after determining the address; step 207, preparing fault data before writing the fault data into FLASH; Judging condition 201, when the SRAM is not full of the set data number, storing the data to FLASH according to first-in first-out sequence, otherwise, requiring subsequent steps to process; the process 208 is executed when the judging condition 201 is not met, the data is directly read from the SRAM and cached into the array, the length of the array is 256, the maximum 256 is taken when the number of the array read exceeds 256, otherwise, the actual residual number of the SRAM is taken; A flow 209, writing a starting instruction according to a FLASH data manual, and after FLASH addresses are allocated, writing the array data in the flow 208 into FLASH in sequence; the process 2010 is executed when the judging condition 201 is met, and the un-updated SRAM data is cached in the array, wherein the caching mode is the same as that described in the process 208; A process 2011, writing a starting instruction according to a FLASH data manual, and after FLASH addresses are allocated, writing the array data in the process 2010 into FLASH in sequence; process 2012, reading the updated SRAM data and caching the updated SRAM data into an array; a process 2013, writing a starting instruction according to a FLASH data manual, and after FLASH addresses are allocated, writing the array data in the process 2012 into FLASH in sequence; Flow 2014, after completing the data record before failure through the previous steps, the software failure code when failure occurs is written in.
  7. 7. The method of claim 1, wherein the pre-set FLASH data reading procedure further comprises: The process 301 is to read 1-4 data of the N group of data, and N is equal to 0; A flow 302, transmitting the data read in the flow 301 to an external bus through CAN communication; if 1-4 FLASH data of the read N groups are not transmitted to the bus through the CAN, waiting for the transmission to be completed, and not reading new data during waiting, otherwise executing the next step; process 303, reading 5-8 data of the nth group of data, where N is equal to 0; a flow 304, transmitting the data read in the flow 303 to an external bus through CAN communication; a condition judgment 302, if the read N groups of 5-8 FLASH data are not transmitted to the bus through the CAN, waiting for the transmission to be completed, and not reading new data during the waiting period, otherwise executing the next step; flow 305, reading 9-12 data of the nth group of data, where N is equal to 0; a flow 306, transmitting the data read in the flow 305 to an external bus through CAN communication; if 9-12 FLASH data of the read N groups are not transmitted to the bus through the CAN, waiting for the transmission to be completed, and not reading new data during waiting, otherwise executing the next step; Flow 307, reading 13-16 data of the nth group of data, N being equal to 0; A flow 308, transmitting the data read in the flow 307 to an external bus through CAN communication; The condition judgment 304 is that if 13-16 FLASH data of the N groups are read and are not transmitted to the bus through the CAN, waiting for the transmission to be completed, and not reading new data during waiting, otherwise executing the next step; Flow 309 n=n+1, i.e. calculating the sequence number for transmitting the next set of data; If the condition is judged 305 that N is equal to the set value, that is, all the data recorded by FLASH are read for one time, the data reading is finished, otherwise, the process 301 is repeated; flow 3010, stop reading FLASH data, N to 0.
  8. 8. A device for implementing a black box function based on DSP28335 FLASH SRAM and FLASH, the device comprising: The chip connection module is used for externally connecting a static random access memory SRAM and a FLASH memory FLASH for the DSP28335 chip through XINTF interfaces; The data recording module is used for recording preset operation data of the DSP28335 chip by using the external expansion SRAM based on a preset external expansion SRAM data recording flow; The data storage module is used for storing the data of the external expansion SRAM record based on a preset external expansion FLASH data storage flow; And the data reading module is used for reading the data recorded by the external expansion SRAM based on a preset external expansion FLASH data reading flow.
  9. 9. An electronic device, comprising Processor, and A memory having stored thereon computer readable instructions which, when executed by the processor, implement the method according to any of claims 1 to 7.
  10. 10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, implements the method according to any of claims 1 to 7.

Description

Method for realizing black box function based on DSP 28335 external expansion SRAM and FLASH Technical Field The disclosure relates to the field of new energy automobile power generation systems, in particular to a method, a device, electronic equipment and a computer readable storage medium for realizing a black box function based on a DSP 28335 external SRAM and a FLASH. Background When an engine assembly or a GCU (motor controller) in the power generation system has serious faults, the black box can record data of a period of time before the power generation system has serious faults in real time, so that fault information analysis can be conveniently carried out by professionals, key data record and importance are carried out on the automobile power generation system in operation, when the system has serious faults, the black box can record the operation state of the key data before the faults occur in time, the data cannot be lost after power failure, and follow-up fault cause analysis and problem positioning are convenient. The prior art for implementing the fault data recording function based on TMS320F28335 includes: The TMS320F28335 in-chip SRAM and FLASH are used, so that the in-chip resource can be fully utilized, the software development and migration time is short, the defects in the project are obvious, and although 256K X16 bit FLASH and 34K X16 bit SRAM exist in 28335 chips, for complex application, the program and data space may not be enough, so that the subsequent function development is limited; When the system is in fault, the fault data is stored in the EEPROM, and then the problem analysis and positioning are carried out by checking the historical fault record data stored in the EEPROM, the method is mostly used for recording the data at the moment of fault, the stored data are relatively small, a fault data curve cannot be generated, the operation data in 5 seconds before the fault and even in 10 seconds before the fault cannot be traced, and the fault problem analysis and positioning help is relatively limited. Accordingly, there is a need for one or more approaches to address the above-described problems. It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the present disclosure and thus may include information that does not constitute prior art known to those of ordinary skill in the art. Disclosure of Invention It is an object of the present disclosure to provide a method, apparatus, electronic device, and computer-readable storage medium for implementing a "black box" function based on DSP 28335 FLASH SRAM and FLASH, thereby overcoming, at least in part, one or more of the problems due to the limitations and disadvantages of the related art. According to one aspect of the present disclosure, there is provided a method for implementing a "black box" function based on DSP 28335 FLASH and FLASH, including: A static random access memory SRAM and a FLASH memory FLASH are connected for the DSP28335 chip through XINTF interface expansion; Recording preset operation data of the DSP28335 chip by using the external expansion SRAM based on a preset external expansion SRAM data recording flow; The method comprises the steps that the FLASH of the external expansion is stored on the basis of a preset FLASH data storage flow of the external expansion, so that the data recorded by the SRAM of the external expansion are stored; and reading the data recorded by the external SRAM by the external FLASH based on a preset external FLASH data reading flow. In an exemplary embodiment of the present disclosure, the method further comprises: 20 address lines and 4 GPIO ports of the DSP28335 chip are used as address lines XA20-XA23 of the FLASH chip which is expanded. In an exemplary embodiment of the disclosure, the preset operation data in the method are data of voltage, current and temperature of the DSP28335 chip. In an exemplary embodiment of the present disclosure, the method further comprises: XRD pins of the DSP28335 chip are respectively connected with read permission control signals OE# of the FLASH and SRAM; The XWE0 pin of the DSP28335 chip is respectively connected with write protection control signals WE# of the FLASH memory and the SRAM; the GPIO pin of DSP28335 chip is connected with the FLASH RY/BY that expands outward, allow to operate FLASH when this pin is high level. In an exemplary embodiment of the present disclosure, the method further includes: setting total number of SRAM record data, wherein the total number comprises member number and total group number in each group; process 102, initializing SRAM data to 0; If serious fault occurs, F28335 does not update data to SRAM any more, otherwise, the key data is continuously updated; step 103, if the fault exists, the SRAM is not enabled any more, and the data is stopped to be updated; 104, if no fault exists, recording one group of data each time,