Current feedback method and system, vehicle-mounted electronic controller and storage medium
By selecting the target channel in the current feedback channel and processing the effective flag bit, the problem of current feedback delay in the prior art is solved, and current feedback can be performed after the calculation of part of the chip channel is completed, reducing the current feedback time.
Patent Information
- Application Number
- CN202411249764.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-27
AI Technical Summary
When calculating the average current, the effective flag bit may be set when the calculation is not completed, resulting in a delay or interruption of the current feedback, increasing the current feedback time.
By selecting the target channel in the current feedback channel and ignoring the valid flag when the current is read as the first communication cycle, use the current value of the previous communication cycle as the calculation current, and update the polling pointer after the current calculation is completed, ensure that Current feedback is performed after the channel calculation is completed.
The current feedback time is reduced, and the problem of the effective flag bit being set when the calculation is not completed is avoided. It can realize that current feedback can be performed after the calculation of part of the target chip channel is completed.
Smart Images

Figure CN119201800A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic circuits, and in particular to a current feedback method and system, a vehicle-mounted electronic controller and a storage medium. Background Art
[0002] Some chips may have an average current calculation unit inside the chip, which is triggered by an SPI (Serial Peripheral Interface, SPI for short) instruction to calculate the average current of a channel within a dither cycle (also called a dither cycle) or a pulse width modulation chopper (PWM chopper) cycle.
[0003] Since the calculation unit can only calculate the average current of one channel at the same time, if the calculation unit receives a command to calculate the current of other channels before the calculation of the average current of the channel is completed, the calculation unit will directly respond to the new command, resulting in the interruption of the calculation process being executed, and the original calculation result will not be fed back. In addition, when a channel is calculated, the chip will set a valid flag (also called a valid flag) and feed back this flag and the calculated average current to the microcontroller (Microcontroller Unit, referred to as MCU) through a serial peripheral interface instruction message (SPI message). However, in actual testing, it was found that this part of the chip has the problem that the valid flag is set when the calculation is not actually completed. At the same time, when this part of the chip performs current feedback, it is necessary to wait for all channels in the chip to complete the calculation before completing the current feedback, which increases or delays the current feedback time. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, an object of the present invention is to provide a current feedback method and system, a vehicle-mounted electronic controller and a storage medium, so as to solve the problems existing in the prior art.
[0005] To achieve the above object and other related objects, the present invention provides a current feedback method, comprising the following steps:
[0006] Selecting a channel from the current feedback channels determined in advance or in real time as a target channel; wherein some channels in the target chip constitute the current feedback channel;
[0007] When the current reading of the target channel is the first communication cycle in this polling, the valid flag of the feedback current of the target chip is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged to point to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling;
[0008] When the feedback current of at least one channel in the current feedback channel is obtained, current feedback is directly performed.
[0009] In one embodiment of the present invention, when the target channel is not the first communication cycle of this polling, the process of obtaining the calculated current of the target channel includes:
[0010] Receive and respond to an SPI instruction for calculating the current of the target channel;
[0011] calculating an average current based on the current recorded within a tremor cycle, and determining whether the recorded current belongs to a complete tremor cycle of the target channel;
[0012] When the recorded current belongs to a complete tremor cycle of the target channel, the target chip sets a valid flag, and feeds back the calculated average current through the serial peripheral device interface as the calculated current of the target channel;
[0013] When the recorded current does not belong to a complete tremor cycle of the target channel, the valid flag is cleared, and the effective current calculated in the last polling cycle is fed back through the serial peripheral device interface as the calculated current of the target channel.
[0014] In one embodiment of the present invention, before calculating the average current based on the current recorded in one tremor cycle, the method further includes:
[0015] Compare the target channel with the channel polled in the previous communication cycle;
[0016] If the target channel is different from the channel selected to be read in the previous communication cycle, the valid flag is marked as credible, and the current of the target channel is recorded and calculated;
[0017] If the target channel is the same as the channel selected for reading in the previous communication cycle, the valid flag is marked as unreliable, the current calculation result is discarded, and the polling pointer is kept unchanged to continue reading the current of the current feedback channel.
[0018] In one embodiment of the present invention, when current feedback is performed, the method further includes:
[0019] Identify whether the tremor function is enabled;
[0020] When the dither function is enabled, the feedback delay time of the channel current is T=8*dither cycle;
[0021] When the dither function is not enabled, the feedback delay time of the channel current is T=8*2*SPI instruction cycle.
[0022] In one embodiment of the present invention, before checking whether the target channel is the first communication cycle in this polling, the method further includes:
[0023] Verifying whether the current control mode is current closed-loop control based on the mode configuration of the current polling channel of the target chip;
[0024] If the current control mode of the target chip is not current closed-loop control, the calculated current of the target channel is set to zero, the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling;
[0025] If the current control mode of the target chip is current closed-loop control, check whether the valid flag bit of the target chip feedback is set; and, when the valid flag bit is set, check whether the target channel is the first communication cycle of this polling; or, when the valid flag bit is not set or the target channel is the first communication cycle of this polling, use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel.
[0026] In one embodiment of the present invention, the process of determining the current feedback channel includes:
[0027] Read the channel selection calibration quantity;
[0028] If the channel selection calibration amount is zero, all channels of the target chip are used as the current feedback channels;
[0029] If the channel selection calibration quantity is not zero, check whether the current channel is selected as the current feedback channel; and, when the current channel is selected as the current feedback channel, the polling pointer points to the current channel and waits for the next polling; or, when the current channel is not selected as the current feedback channel, set the calculated current of the current channel to zero, and select the next channel from the current feedback channel to continue polling.
[0030] In one embodiment of the present invention, when the feedback current of at least one channel in the current feedback channel is obtained, the process of performing current feedback includes: performing communication message splicing on the SPI instruction used to calculate the current of the current feedback channel, and storing the spliced message in a transmission buffer, so as to obtain the calculated current of the corresponding channel in the next SPI instruction cycle, and perform current feedback based on the calculated current of the corresponding channel.
[0031] The present application also provides a current feedback system, the system comprising:
[0032] A channel selection module, used to select a channel from the current feedback channels determined in advance or in real time as a target channel; wherein some channels in the target chip constitute the current feedback channel;
[0033] A polling module, for ignoring a valid flag of the feedback current of the target chip, determining that the current calculation is not completed, and taking the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keeping the polling pointer unchanged to point to the target channel, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, determining that the current calculation is completed, and obtaining the calculated current of the target channel, and updating the polling pointer, and selecting the next channel from the current feedback channel to continue polling;
[0034] The current feedback module is used to directly perform current feedback when the feedback current of at least one channel in the current feedback channel is obtained.
[0035] The present invention also provides a vehicle-mounted electronic controller, comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the current feedback methods described above.
[0036] The present invention also provides a storage medium, wherein a program is stored on the storage medium, and when the program is executed by a processor, the program is used to implement the steps of the current feedback method as claimed in any one of the above claims.
[0037] As described above, the present invention provides a current feedback method and system, a vehicle-mounted electronic controller and a storage medium, which have the following beneficial effects:
[0038] The present invention selects some channels from the target chip determined in advance or in real time to form a current feedback channel, and then selects a channel from the current feedback channel as the target channel; when the current reading of the target channel is the first communication cycle in this polling, the target chip feedback current valid flag is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged, pointing to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the target chip feedback current valid flag is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; when the feedback current of at least one channel in the current feedback channel is obtained, current feedback is directly performed. It can be seen from this that the present invention realizes the fixed collection of currents of several channels by using the method of selecting the collection channel, and current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of an exemplary system architecture for applying the technical solutions in one or more embodiments of the present invention;
[0040] Figure 2 A schematic diagram of a flow chart of a current feedback method provided in an embodiment of the present invention;
[0041] Figure 3 A schematic diagram of a flow chart of current calculation provided by an embodiment of the present invention;
[0042] Figure 4 A schematic diagram of a flow chart of flag bit filtering provided by an embodiment of the present invention;
[0043] Figure 5 A schematic diagram of a flow chart of channel selection provided in an embodiment of the present invention;
[0044] Figure 6 SPI timing diagram of four channels provided in one embodiment of the present invention;
[0045] Figure 7 A schematic diagram of the hardware structure of a current feedback system provided in one embodiment of the present invention;
[0046] Figure 8 The figure is a schematic diagram of the hardware structure of a vehicle-mounted electronic controller suitable for implementing one or more embodiments of the present invention. DETAILED DESCRIPTION
[0047] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0048] It should be noted that the illustrations provided in this embodiment are only used to illustrate the basic concept of the present invention in a schematic manner. Therefore, the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0049] Figure 1 FIG. 1 is a schematic diagram showing an exemplary system architecture to which the technical solution in one or more embodiments of the present invention can be applied. Figure 1 As shown, the system architecture 100 may include a terminal device 110, a network 120, and a server 130. The terminal device 110 may include various electronic devices such as a smart phone, a tablet computer, a laptop computer, and a desktop computer. The server 130 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The network 120 may be a communication medium of various connection types that can provide a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0050] According to the implementation requirements, the system architecture in the embodiment of the present invention may have any number of terminal devices, networks and servers. For example, the server 130 may be a server group composed of multiple server devices. In addition, the technical solution provided in the embodiment of the present invention may be applied to the terminal device 110, or to the server 130, or may be implemented by the terminal device 110 and the server 130 together, and the present invention does not make any special limitation on this.
[0051] In one embodiment of the present invention, the terminal device 110 or the server 130 of the present invention can select some channels from the target chip determined in advance or in real time to form a current feedback channel, and then select a channel from the current feedback channel as the target channel; when the current reading of the target channel is the first communication cycle in this polling, the valid flag of the feedback current of the target chip is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged and points to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; when the feedback current of at least one channel in the current feedback channel is obtained, the current feedback is directly performed. The current feedback method is performed by the terminal device 110 or the server 130, and the fixed collection of the current of several channels can be realized by using the method of selecting the collection channel, and the current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time.
[0052] The above section introduces the contents of an exemplary system architecture to which the technical solution of the present invention is applied. Next, the current feedback method of the present invention will be introduced.
[0053] Figure 2 FIG. 1 is a flow chart of a current feedback method provided by an embodiment of the present invention. Specifically, in an exemplary embodiment, Figure 2 As shown, this embodiment provides a current feedback method, which includes the following steps:
[0054] S210, select a channel from the current feedback channels determined in advance or in real time as the target channel; wherein some channels in the target chip constitute the current feedback channel. In this embodiment or other embodiments, the target chip can be selected according to actual conditions, for example, it can be a car chip. As an example, the target chip in this embodiment can be a TLE8242 chip. In this embodiment or other embodiments, before selecting the target channel, some channels can be selected from all channels in the target chip as the current feedback channel.
[0055] S220, when the current reading of the target channel is the first communication cycle in this polling, ignore the valid flag of the feedback current of the target chip, and determine that the current calculation is not completed, and use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, determine that the current calculation is completed, and obtain the calculated current of the target channel, and update the polling pointer, and select the next channel from the current feedback channel to continue polling. In this embodiment or other embodiments, the preset value can be set according to actual conditions, for example, the preset value can be a value of 1.
[0056] S230, when the feedback current of at least one channel in the current feedback channel is obtained, directly perform current feedback.
[0057] It can be seen that this embodiment realizes fixed current recovery of certain channels by using the method of selecting the recovery channel, and current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time.
[0058] According to the above records, in an exemplary embodiment, when the target channel is not the first communication cycle of this polling, the process of obtaining the calculated current of the target channel includes: receiving and responding to an SPI instruction for calculating the current of the target channel; calculating the average current based on the current recorded within a tremor cycle, and determining whether the recorded current belongs to a complete tremor cycle of the target channel; when the recorded current belongs to a complete tremor cycle of the target channel, the valid flag is set through the target chip, and the calculated average current is fed back through the serial peripheral device interface as the calculated current of the target channel; when the recorded current does not belong to a complete tremor cycle of the target channel, the software connected to the target chip ignores the valid flag transmitted by the chip and clears the valid flag, and feeds back the valid current calculated in the previous polling cycle through the serial peripheral device interface as the calculated current of the target channel. In this embodiment, before calculating the average current based on the current recorded in a vibration cycle, it can also include: comparing the target channel with the polling channel during the previous communication cycle polling; if the target channel is located in the polling channel during the previous communication cycle polling, then marking the valid flag bit as credible, and recording and calculating the current of the target channel; if the target channel is not located in the polling channel during the previous communication cycle polling, then marking the valid flag bit as unreliable, discarding the current calculation result, and keeping the polling pointer unchanged, and continuing to read the current of the currently selected channel.
[0059] According to the above records, in an exemplary embodiment, before checking whether the target channel is the first communication cycle in this polling, this embodiment may also include: verifying whether the current control mode is current closed-loop control based on the mode configuration of the current polling channel of the target chip; if the current control mode of the target chip is not current closed-loop control, the calculated current of the target channel is set to zero, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling. If the current control mode of the target chip is current closed-loop control, check whether the valid flag bit of the target chip feedback is set; and, when the valid flag bit is set, check whether the target channel is the first communication cycle of this polling; or, when the valid flag bit is not set or the target channel is the first communication cycle of this polling, use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel.
[0060] According to the above records, in an exemplary embodiment, when current feedback is performed, this embodiment may also include: identifying whether the tremor function is enabled; when the tremor function is enabled, the feedback delay time of the channel current is T=8*tremor cycle; when the tremor function is not enabled, the feedback delay time of the channel current is T=8*2*SPI instruction cycle. Among them, in this embodiment or other embodiments, the tremor function is a function in the solenoid valve control, specifically refers to the solenoid valve control to make the actual current fluctuate periodically around the target current, so that the solenoid valve valve core vibrates. This allows the valve core to overcome static friction at all times, allowing the solenoid valve to respond faster to new current commands.
[0061] According to the above records, in an exemplary embodiment, the process of determining the current feedback channel includes: reading the channel selection calibration quantity; if the channel selection calibration quantity is zero, all channels of the target chip are used as current feedback channels; if the channel selection calibration quantity is not zero, checking whether the current channel is selected as the current feedback channel; and, when the current channel is selected as the current feedback channel, the polling pointer points to the current channel and waits for the next polling; or, when the current channel is not selected as the current feedback channel, the calculated current of the current channel is set to zero, and the next channel is selected from the current feedback channel to continue polling.
[0062] According to the above records, in an exemplary embodiment, when the feedback current of at least one channel in the current feedback channel is obtained, the process of performing current feedback includes: performing communication message splicing on the SPI instruction for calculating the current of the current feedback channel, and storing the spliced message in the transmission buffer, so as to obtain the calculated current of the corresponding channel in the next SPI instruction cycle, and perform current feedback based on the calculated current of the corresponding channel.
[0063] In another exemplary embodiment of the present invention, if the target chip is a TLE8242 chip, a channel is selected from the TLE8242 chip and recorded as channel a. Specifically, Figure 3 As shown in Figure 2, the calculation process of the channel current is as follows: Figure 3 As shown, first receive the SPI command for calculating the current of channel a, and determine whether the calculated channel is the same as the previous SPI cycle. If they are not the same, it is considered that the average current of this feedback cannot be calculated, and the result of this feedback is not credible regardless of the status of the valid flag bit, so the current channel is still read in the next SPI cycle; if they are the same, the valid flag bit is considered credible. Then, determine whether to read the channel average current fed back by the chip this time according to the valid flag bit status. Therefore, when the calculated channel is different from the previous SPI cycle, the old feedback current calculation result is overwritten with the newly obtained feedback current calculation result, and the current of the new channel is recorded. When the calculated channel is the same as the previous SPI cycle, continue to record and calculate the current of the current channel. The chip calculates the average current based on the current in a tremor cycle, and determines whether the average current calculation of a complete tremor cycle has been completed. If the average current calculation of a complete tremor cycle has been completed, the valid flag is set, and the calculated current is fed back through SPI; if the average current calculation of a complete tremor cycle has not been completed, the valid flag is cleared, and a false calculated current is fed back through SPI. In this embodiment, the effective current calculated in the last polling cycle can be used as the pseudo calculated current.
[0064] For this embodiment, in each SPI instruction cycle, the MCU will send a command to calculate the current of one channel to the TLE8242 chip, so that the average current calculation unit of the TLE8242 chip works, and at the same time trigger the TLE8242 chip to send the SPI message of the feedback current. After the MCU receives the feedback message, it will check the calculation valid flag. If this flag is not set, the MCU will still send a command to calculate the current of the original channel in the next SPI command cycle; if the valid flag is set, the MCU will read the feedback current in this message, and then send a command to calculate the current of the next channel in the next SPI command cycle. Among them, in general applications, once the dither function is used, its cycle setting is usually much longer than the SPI instruction cycle. When the channel dither function is enabled, the feedback current waiting time is mainly restricted by the dither cycle, and the feedback delay time of the channel current is T=8*dither cycle; when the channel dither function is not enabled, the feedback current waiting time is mainly restricted by the SPI command cycle, and the feedback delay time of the channel current is T=8*2*SPI instruction cycle.
[0065] In this embodiment, since the valid flag bit has two states, credible and untrustworthy, this embodiment can also perform flag bit filtering. Specifically, Figure 4As shown in the figure, when channel a is polled, the feedback current of channel a is obtained through SPI communication, the callback function of SPI communication is triggered, and then the control mode of this channel is verified to be current closed-loop control based on the mode configuration of channel a. If it is not current closed-loop control, the calculated current of channel a is set to 0, and the polling pointer is updated to point to the next channel in the TLE8242 chip, and the SPI command is spliced at the same time. If it is a current closed-loop control, then check whether the valid flag is set, and when the valid flag is not set, maintain the calculated current of the channel at the value of the previous communication cycle polling, and keep the polling pointer unchanged, pointing to the original channel, and splice the SPI command; if the valid flag is set, check whether the channel is polled for the first time; when the channel is polled for the first time, ignore the valid flag of the chip feedback and maintain the calculated current of the channel at the value of the previous communication cycle polling, and keep the polling pointer unchanged, pointing to the original channel, and splice the SPI command; if the channel is not polled for the first time, obtain the calculated current of the channel, and update the polling pointer to point to the next channel in the TLE8242 chip, and splice the SPI command. Then read the feedback current according to the splicing result of the SPI command. In this embodiment, the SPI command message can be spliced by C language command, and the spliced message is stored in the transmission buffer TxBuffer, so as to realize the current reading of the corresponding channel in the next SPI instruction cycle.
[0066] According to the above records, in this embodiment, if the valid flag position of this SPI instruction cycle has been successfully read, the channel index index is increased by one to point to the next channel. Then it is determined whether the next channel is selected. If not, the channel index index will jump to the next channel to continue the determination until the pre-selected channel in the TLE8242 chip is polled. In this implementation, the process of channel selection is as follows: Figure 5 As shown. Figure 5In the process, when the calculated current of channel a has been successfully read, the channel to be read in the next cycle is selected, that is, the channel selection calibration quantity is read. In this embodiment, the channel selection can be implemented using two 8-byte calibration quantities, one calibration quantity corresponds to a TLE8242 chip, and each byte bit corresponds to a channel. Determine whether the channel selection calibration quantity is 0; if the channel selection calibration quantity is 0, read the current of all 8 channels in the TLE8242 chip to avoid an infinite loop, and at the same time, the polling pointer points to the first selected channel, waiting for the next cycle, and performing SPI commands for splicing. If the channel selection calibration quantity is not 0, check whether the current channel is selected; if the current channel is selected, the polling pointer points to the channel, waiting for the next cycle, and performing SPI commands for splicing; if the current channel is not selected, set the feedback current of the channel to 0, and pass the polling pointer to the next channel. Then read the feedback current according to the splicing result of the SPI command. In this embodiment, the SPI command message can be spliced by C language command, and the spliced message is stored in the transmission buffer TxBuffer, so as to realize the current reading of the corresponding channel in the next SPI instruction cycle.
[0067] According to the above records, in this embodiment, the current of four channels can be selected from all eight channels of the TLE8242 chip for feedback, wherein the four channels are CH1 channel, CH2 channel, CH3 channel and CH4 channel, and the SPI timing diagram corresponding to the four channels is as follows: Figure 6 As shown. Figure 6 It can be seen that for the TLE8242 chip, when the current reading SPI communication cycle is 2.5ms and the dither function is not enabled, the theoretical time of current feedback can be improved by 20ms by selecting four channels for current feedback compared with selecting all eight channels.
[0068] In summary, the present invention provides a current feedback method, which selects some channels from a target chip determined in advance or in real time to form a current feedback channel, and then selects a channel from the current feedback channel as the target channel; when the current reading of the target channel is the first communication cycle in this polling, the valid flag of the feedback current of the target chip is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged, pointing to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; when the feedback current of at least one channel in the current feedback channel is obtained, the current feedback is directly performed. It can be seen from this that the method realizes the fixed collection of the current of several channels by using the method of selecting the collection channel, and the current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time. At the same time, the method can also filter the valid flag bit, thereby solving the problem that the valid flag bit is set when the calculation is not actually completed.
[0069] In another exemplary embodiment of the present invention, Figure 7 As shown, this embodiment also provides a current feedback system, including:
[0070] The channel selection module 710 is used to select a channel as a target channel from the current feedback channels determined in advance or in real time; wherein some channels in the target chip constitute the current feedback channel. In this embodiment or other embodiments, the target chip can be selected according to actual conditions, for example, it can be a car chip. As an example, the target chip in this embodiment can be a TLE8242 chip. In this embodiment or other embodiments, before selecting the target channel, some channels can be selected from all channels in the target chip as current feedback channels.
[0071] The polling module 720 is used to ignore the valid flag of the feedback current of the target chip when the current reading of the target channel is the first communication cycle in this polling, and determine that the current calculation is not completed, and use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, determine that the current calculation is completed, and obtain the calculated current of the target channel, and update the polling pointer, and select the next channel from the current feedback channel to continue polling. In this embodiment or other embodiments, the preset value can be set according to the actual situation, for example, the preset value can be a value of 1.
[0072] The current feedback module 730 is used to directly perform current feedback when the feedback current of at least one channel in the current feedback channel is obtained.
[0073] It can be seen that this embodiment realizes fixed current recovery of certain channels by using the method of selecting the recovery channel, and current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time.
[0074] According to the above records, in an exemplary embodiment, when the target channel is not the first communication cycle of this polling, the process of obtaining the calculated current of the target channel includes: receiving and responding to an SPI instruction for calculating the current of the target channel; calculating the average current based on the current recorded within a tremor cycle, and determining whether the recorded current belongs to a complete tremor cycle of the target channel; when the recorded current belongs to a complete tremor cycle of the target channel, the valid flag is set through the target chip, and the calculated average current is fed back through the serial peripheral device interface as the calculated current of the target channel; when the recorded current does not belong to a complete tremor cycle of the target channel, the software connected to the target chip ignores the valid flag transmitted by the chip and clears the valid flag, and feeds back the valid current calculated in the previous polling cycle through the serial peripheral device interface as the calculated current of the target channel. In this embodiment, before calculating the average current based on the current recorded in a vibration cycle, it can also include: comparing the target channel with the polling channel during the previous communication cycle polling; if the target channel is located in the polling channel during the previous communication cycle polling, then marking the valid flag bit as credible, and recording and calculating the current of the target channel; if the target channel is not located in the polling channel during the previous communication cycle polling, then marking the valid flag bit as unreliable, discarding the current calculation result, and keeping the polling pointer unchanged, and continuing to read the current of the currently selected channel.
[0075] According to the above records, in an exemplary embodiment, before checking whether the target channel is the first communication cycle in this polling, this embodiment may also include: verifying whether the current control mode is current closed-loop control based on the mode configuration of the current polling channel of the target chip; if the current control mode of the target chip is not current closed-loop control, the calculated current of the target channel is set to zero, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling. If the current control mode of the target chip is current closed-loop control, check whether the valid flag bit of the target chip feedback is set; and, when the valid flag bit is set, check whether the target channel is the first communication cycle of this polling; or, when the valid flag bit is not set or the target channel is the first communication cycle of this polling, use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel.
[0076] According to the above records, in an exemplary embodiment, when current feedback is performed, this embodiment may also include: identifying whether the tremor function is enabled; when the tremor function is enabled, the feedback delay time of the channel current is T=8*tremor cycle; when the tremor function is not enabled, the feedback delay time of the channel current is T=8*2*SPI instruction cycle. Among them, in this embodiment or other embodiments, the tremor function is a function in the solenoid valve control, specifically refers to the solenoid valve control to make the actual current fluctuate periodically around the target current, so that the solenoid valve valve core vibrates. This allows the valve core to overcome static friction at all times, allowing the solenoid valve to respond faster to new current commands.
[0077] According to the above records, in an exemplary embodiment, the process of determining the current feedback channel includes: reading the channel selection calibration quantity; if the channel selection calibration quantity is zero, all channels of the target chip are used as current feedback channels. If the channel selection calibration quantity is not zero, it is checked whether the target channel is selected as the current feedback channel; and when the target channel is selected as the current feedback channel, the polling pointer points to the target channel and waits for the next polling; or, when the target channel is not selected as the current feedback channel, the calculated current of the target channel is set to zero, and the next channel is selected from the current feedback channel to continue polling.
[0078] According to the above records, in an exemplary embodiment, when the feedback current of at least one channel in the current feedback channel is obtained, the process of performing current feedback includes: performing communication message splicing on the SPI instruction for calculating the current of the current feedback channel, and storing the spliced message in the transmission buffer, so as to obtain the calculated current of the corresponding channel in the next SPI instruction cycle, and perform current feedback based on the calculated current of the corresponding channel.
[0079] In summary, the present invention provides a current feedback system, which selects some channels from a target chip determined in advance or in real time to form a current feedback channel, and then selects a channel from the current feedback channel as the target channel; when the current reading of the target channel is the first communication cycle in this polling, the valid flag of the feedback current of the target chip is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged, pointing to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; when the feedback current of at least one channel in the current feedback channel is obtained, the current feedback is directly performed. It can be seen from this that the system realizes the fixed collection of currents of several channels by using the method of selecting the collection channel, and current feedback can be performed after the calculation of some channels in the target chip is completed, thereby reducing the current feedback time. At the same time, the system can also filter the valid flag bit, thereby solving the problem that the valid flag bit is set when the calculation is not actually completed.
[0080] It should be noted that the current feedback system provided in the above embodiment and the current feedback method provided in the above embodiment belong to the same concept, wherein the specific manner in which the current feedback method performs the operation has been described in detail in the above method embodiment, and will not be repeated here. In practical applications, the current feedback system provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the current feedback system into different functional modules, and then implement all or part of the functions of the corresponding functional modules through the current feedback method described in the above embodiment, and this is not specifically limited here.
[0081] The embodiment of the present invention further provides a vehicle-mounted electronic controller, which may include a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program so that the vehicle-mounted electronic controller executes Figure 2 The steps of the current feedback method. Figure 8 1 shows a schematic diagram of the structure of a vehicle-mounted electronic controller 1000. Figure 8 As shown, the vehicle-mounted electronic controller 1000 includes: a processor 1010 , a memory 1020 , a power supply 1030 , a display unit 1040 , and an input unit 1060 .
[0082] The processor 1010 is the control center of the vehicle electronic controller 1000. It uses various interfaces and lines to connect various components, and executes various functions of the vehicle electronic controller 1000 by running or executing computer programs / instructions stored in the memory 1020, thereby monitoring the vehicle electronic controller 1000 as a whole. In the embodiment of the present invention, when the processor 1010 calls the computer program stored in the memory 1020, the following is executed: Figure 2 The steps of the current feedback method. Optionally, the processor 1010 may include one or more processing units; preferably, the processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and applications, and the modem processor mainly processes wireless communications. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips.
[0083] The memory 1020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, various applications, etc.; the data storage area may store instruction data created according to the use of the vehicle-mounted electronic controller 1000, etc. In addition, the memory 1020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices, etc.
[0084] The vehicle electronic controller 1000 also includes a power source 1030 (such as a battery) for supplying power to various components. The power source can be logically connected to the processor 1010 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0085] The display unit 1040 may be used to display information input by the user or information provided to the user and various menus of the vehicle-mounted electronic controller 1000, and in the embodiment of the present invention, is mainly used to display the display interface of each application in the vehicle-mounted electronic controller 1000 and objects such as text and pictures displayed in the display interface. The display unit 1040 may include a display panel 1050. The display panel 1050 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), and the like.
[0086] The input unit 1060 may be used to receive information such as numbers or characters input by the user. The input unit 1060 may include a touch panel 1070 and other input devices 1080. The touch panel 1070, also known as a touch screen, may collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 1070).
[0087] Specifically, the touch panel 1070 can detect the user's touch operation, detect the signal brought by the touch operation, convert these signals into touch point coordinates, send them to the processor 1010, and receive and execute the command sent by the processor 1010. In addition, the touch panel 1070 can be implemented in various types such as resistive, capacitive, infrared and surface acoustic wave. Other input devices 1080 can include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0088] Of course, the touch panel 1070 can cover the display panel 1050. When the touch panel 1070 detects a touch operation on or near it, it is transmitted to the processor 1010 to determine the type of touch event, and then the processor 1010 provides a corresponding visual output on the display panel 1050 according to the type of touch event. Figure 8 In the embodiment, the touch panel 1070 and the display panel 1050 are two independent components to realize the input and output functions of the vehicle electronic controller 1000, but in some embodiments, the touch panel 1070 and the display panel 1050 can be integrated to realize the input and output functions of the vehicle electronic controller 1000.
[0089] The vehicle-mounted electronic controller 1000 may further include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the vehicle-mounted electronic controller 1000 may also include other components such as a camera.
[0090] The embodiment of the present invention further provides a computer-readable storage medium, in which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the above-mentioned device can perform the present invention as follows: Figure 2 The steps of the current feedback method.
[0091] It can be understood by those skilled in the art that Figure 8This is only an example of an on-board electronic controller and does not constitute a limitation on the device. The device may include more or fewer components than shown in the figure, or combine certain components, or different components. For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing the present invention, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0092] Those skilled in the art should understand that the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be applied to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0093] In another exemplary embodiment of the present invention, the embodiment further provides a vehicle, which includes a current feedback system as described in the above embodiment, or includes an on-board electronic controller as described in the above embodiment. It should be noted that since the specific manner in which the current feedback system and the on-board electronic controller perform operations has been described in detail in the embodiments, the technical functions and effects of the vehicle provided in this embodiment can be referred to the above embodiments, and will not be repeated here.
[0094] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A current feedback method, characterized in that: The method comprises the following steps: Selecting a channel from the current feedback channels determined in advance or in real time as a target channel; wherein some channels in the target chip constitute the current feedback channel; When the current reading of the target channel is the first communication cycle in this polling, the valid flag of the feedback current of the target chip is ignored, and the current calculation is deemed to be incomplete, and the current value obtained by polling in the previous communication cycle is used as the calculated current of the target channel, and the polling pointer is kept unchanged to point to the target channel; or, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, the current calculation is deemed to be completed, and the calculated current of the target channel is obtained, and the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; When the feedback current of at least one channel in the current feedback channel is obtained, current feedback is directly performed.
2. The current feedback method according to claim 1, characterized in that: When the target channel is not the first communication cycle of this polling, the process of obtaining the calculated current of the target channel includes: Receive and respond to an SPI instruction for calculating the current of the target channel; calculating an average current based on the current recorded within a tremor cycle, and determining whether the recorded current belongs to a complete tremor cycle of the target channel; When the recorded current belongs to a complete tremor cycle of the target channel, the target chip sets a valid flag, and feeds back the calculated average current through the serial peripheral device interface as the calculated current of the target channel; When the recorded current does not belong to a complete tremor cycle of the target channel, the valid flag is cleared, and the effective current calculated in the last polling cycle is fed back through the serial peripheral device interface as the calculated current of the target channel.
3. The current feedback method according to claim 2, characterized in that: Before calculating the average current based on the current recorded in one tremor cycle, the method further includes: Compare the target channel with the channel polled in the previous communication cycle; If the target channel is different from the channel selected to be read in the previous communication cycle, the valid flag is marked as credible, and the current of the target channel is recorded and calculated; If the target channel is the same as the channel selected for reading in the previous communication cycle, the valid flag is marked as unreliable, the current calculation result is discarded, and the polling pointer is kept unchanged to continue reading the current of the current feedback channel.
4. The current feedback method according to claim 2 or 3, characterized in that: When current feedback is performed, the method further includes: Identify whether the tremor function is enabled; When the dither function is enabled, the feedback delay time of the channel current is T=8*dither cycle; When the dither function is not enabled, the feedback delay time of the channel current is T=8*2*SPI instruction cycle.
5. The current feedback method according to claim 1, characterized in that: Before checking whether the target channel is the first communication cycle in this polling, the method further includes: Verifying whether the current control mode is current closed-loop control based on the mode configuration of the current polling channel of the target chip; If the current control mode of the target chip is not current closed-loop control, the calculated current of the target channel is set to zero, the polling pointer is updated, and the next channel is selected from the current feedback channel to continue polling; If the current control mode of the target chip is current closed-loop control, check whether the valid flag bit of the target chip feedback is set; and, when the valid flag bit is set, check whether the target channel is the first communication cycle of this polling; or, when the valid flag bit is not set or the target channel is the first communication cycle of this polling, use the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keep the polling pointer unchanged, pointing to the target channel.
6. The current feedback method according to claim 1, characterized in that: The process of determining the current feedback channel includes: Read the channel selection calibration quantity; If the channel selection calibration amount is zero, all channels of the target chip are used as the current feedback channels; If the channel selection calibration quantity is not zero, check whether the current channel is selected as the current feedback channel; and, when the current channel is selected as the current feedback channel, the polling pointer points to the current channel and waits for the next polling; or, when the current channel is not selected as the current feedback channel, set the calculated current of the current channel to zero, and select the next channel from the current feedback channel to continue polling.
7. The current feedback method according to claim 1, characterized in that: When the feedback current of at least one channel in the current feedback channel is obtained, the process of performing current feedback includes: performing communication message splicing on the SPI instruction for calculating the current of the current feedback channel, and storing the spliced message in a transmission buffer, so as to obtain the calculated current of the corresponding channel in the next SPI instruction cycle, and perform current feedback based on the calculated current of the corresponding channel.
8. A current feedback system, characterized in that: The system comprises: A channel selection module, used to select a channel from the current feedback channels determined in advance or in real time as a target channel; wherein some channels in the target chip constitute the current feedback channel; A polling module, for ignoring a valid flag of the feedback current of the target chip, determining that the current calculation is not completed, and taking the current value obtained by polling in the previous communication cycle as the calculated current of the target channel, and keeping the polling pointer unchanged to point to the target channel, when the current reading of the target channel is not the first communication cycle in this polling, and the valid flag of the feedback current of the target chip is a preset value, determining that the current calculation is completed, and obtaining the calculated current of the target channel, and updating the polling pointer, and selecting the next channel from the current feedback channel to continue polling; The current feedback module is used to directly perform current feedback when the feedback current of at least one channel in the current feedback channel is obtained.
9. A vehicle-mounted electronic controller, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the current feedback method according to any one of claims 1 to 7.
10. A storage medium having a program stored thereon, wherein when the program is executed by a processor, the program is used to implement the steps of the current feedback method according to any one of claims 1 to 7.