Communication filtering control method for converting TTL (transistor-transistor logic) to CAN (controller area

By using twisted pair cables and magnetic rings for anti-interference processing in the charger's internal circuit, combined with real-time sensing and dynamic filtering strategies, the robustness and accuracy issues of TTL-to-CAN communication under complex electromagnetic interference are solved, and the stability of the communication link and data integrity are achieved.

CN120675643APending Publication Date: 2025-09-19POWERFIRST TECH CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510835040.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

When the TTL-to-CAN communication in the charger's internal circuit faces complex and dynamically changing electromagnetic interference, the fixed anti-interference measures in existing technologies and the lack of intelligent software filtering and dynamic adjustment mechanisms for transmission parameters result in insufficient robustness of the communication link, making it difficult to ensure data transmission accuracy.

Method used

By winding the CAN signal line into a twisted pair and attaching a magnetic ring for anti-interference processing, interference feature information and communication quality indicators are obtained in real time, software filtering strategies are dynamically selected and configured, transmission parameters are adjusted, and collaborative control at the hardware and software levels is combined to achieve real-time response and optimization to electromagnetic interference.

Benefits of technology

It effectively resists electromagnetic interference, ensures the stable operation of communication links in harsh environments, significantly reduces data bit error rate, improves data transmission accuracy and system resource utilization efficiency, and adapts to changes in electromagnetic interference characteristics under different working modes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675643A_ABST
    Figure CN120675643A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication control, and discloses a charger internal circuit TTL-to-CAN communication filtering control method comprising the following steps: S1, presetting CAN physical link anti-interference: CAN signal lines are twisted in pairs and sleeved with magnetic rings; s2, acquiring current interference characteristics of the CAN link in real time and quantifying the current interference characteristics into interference characteristic vectors; s3, evaluating a current communication quality index of the CAN link in real time and quantifying the current communication quality index into a communication quality state vector; s4, according to the data interference and quality vector, dynamically selecting / configuring a filtering algorithm from a preset strategy library to process the received data; and S5, dynamically adjusting CAN link transmission parameters according to data interference and quality vectors. According to the method, the robustness and data accuracy of TTL-to-CAN communication in the charger are improved by sensing interference and communication quality in real time, dynamically adjusting software filtering and transmission parameters and carrying out collaborative learning optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of communication control, and in particular to a TTL to CAN communication filtering control method for an internal circuit of a charger. Background Art

[0002] Currently, with the rapid development of modern electronic technology, chargers, as indispensable energy recharge units for various electronic devices, have become increasingly complex in their internal control logic, placing higher demands on efficient and reliable data communication between internal circuits. In many charger designs, information exchange between microcontrollers (MCUs) or communication between MCUs and peripheral intelligent modules often requires converting TTL (Transistor-Transistor Logic) level signals into CAN (Controller Area Network) bus signals, which are more suitable for long-distance, high-reliability transmission in industrial environments. However, the interior of chargers, especially high-power chargers, is often filled with complex electromagnetic interference generated by switching power supply modules and high-speed switching of power semiconductor devices. This poses a severe challenge to the stability and data accuracy of the TTL-to-CAN communication link. Therefore, researching and developing effective communication filtering and control methods for this scenario has important practical significance and application value.

[0003] Currently, when implementing TTL-to-CAN communication within charger circuits, designers typically employ conventional hardware protection measures to improve interference immunity. These measures include configuring filtering circuits around the CAN transceiver, using shielded cables, and observing proper grounding and wiring rules to suppress some electromagnetic interference. Furthermore, the CAN protocol itself includes error detection mechanisms such as CRC, bit error detection, and frame format checking, which can detect and report communication errors to a certain extent. Some systems may also perform fixed checks or simple filtering on received data at the application level, such as fixed threshold elimination or simple averaging.

[0004] Although the existing technology has guaranteed the basic communication to a certain extent through the above-mentioned hardware protection and the CAN protocol's own error detection mechanism, there are still some shortcomings: First, faced with the complex and changeable electromagnetic interference environment inside the charger, which may be extremely intense, traditional fixed hardware shielding and filtering measures are often difficult to fully adapt to the interference characteristics under all working conditions, and their protection capabilities are limited. When the interference exceeds its design threshold, the robustness of communication will be significantly reduced. This is because these static measures cannot be dynamically adjusted according to the real-time changing interference spectrum and intensity. Secondly, relying solely on the underlying error detection of the CAN protocol, although it can detect most transmission errors, it may be powerless for some subtle data tampering that is not covered by CRC or deviations introduced during the application layer data processing process. In addition, its error handling mechanism (such as error frame, bus shutdown) mainly reports errors rather than actively adapts and purifies data, resulting in the accuracy and integrity of key control information and status data still being at risk. This is because the fixed verification mechanism lacks in-depth analysis and targeted filtering of the data content itself. Furthermore, when software filtering or retransmission strategies are employed in existing technologies, their parameters (such as filter window size and number of retransmissions) are typically fixed and cannot be dynamically optimized based on real-time communication quality and interference levels. This can result in unnecessary processing overhead and communication delays when interference is low (over-protection), or insufficient protection when interference is severe (under-protection). This failure to achieve a dynamic balance between communication resources, microcontroller processing resources, and system response speed is fundamentally due to the lack of real-time perception and feedback loops for current channel status and communication performance. Furthermore, most existing solutions lack environmental adaptability and learning optimization mechanisms, and are unable to automatically adjust and optimize their communication strategies based on long-term operational experience or cyclical environmental changes. This means that the system struggles to "evolve" to adapt to specific or gradually changing interference patterns. Finally, existing technologies often focus on a single level of anti-interference measures, lacking a multi-layered, coordinated, and integrated support system encompassing physical link hardening, real-time status monitoring, intelligent data filtering, and dynamic transmission control. This makes it difficult for measures at all levels to synergize, limiting the potential for improving overall communication quality. Summary of the Invention

[0005] The purpose of the present invention is to provide a TTL to CAN communication filtering control method for the internal circuit of a charger, which solves the problem in the prior art that, when facing complex and dynamically changing electromagnetic interference, the TTL to CAN communication of the internal circuit of the charger is generally subjected to fixed anti-interference measures and lacks intelligent software filtering and a dynamic adjustment mechanism for transmission parameters, resulting in insufficient robustness of the communication link and difficulty in ensuring data transmission accuracy.

[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions: a charger internal circuit TTL to CAN communication filter control method, comprising the following steps: S1. The CAN communication physical link of the charger's internal circuit is pre-processed for anti-interference by twisting the CAN signal line into a twisted pair and sleeved with a magnetic ring; S2. Acquire current interference characteristic information of the CAN communication link of the charger internal circuit in real time, and quantify the interference characteristic information into an interference characteristic vector; S3. Evaluate the current communication quality index of the CAN communication link in real time, and quantify the communication quality index into a communication quality state vector; S4. Based on the interference feature vector and the communication quality state vector, dynamically select at least one filtering algorithm from a preset software filtering strategy library containing multiple algorithms and configure its filtering parameters to filter the data received through the CAN communication link; S5. Based on the interference characteristic vector and the communication quality state vector, dynamically adjust the transmission parameters of the CAN communication link, where the transmission parameters at least include the number of data retransmissions.

[0007] In summary, the present invention includes at least one of the following beneficial technical effects: 1. This invention pre-processes the CAN communication physical link for anti-interference by laying twisted pairs and connecting magnetic rings. Combining real-time perception of interference characteristics and communication quality, it dynamically adjusts the data filtering strategy at the software level and the data retransmission mechanism at the hardware level. This invention can effectively resist various types of electromagnetic interference generated by power device switching, high-frequency signal crosstalk, and other factors within the charger, ensuring the continued stable operation of the communication link in harsh environments.

[0008] 2. The present invention not only relies on the error detection capability of the CAN protocol itself, but also introduces software filtering algorithms with dynamically selectable and configurable parameters at the application level, such as duplicate data consistency check and median filtering, to deeply purify and verify the received data, thereby significantly reducing the data error rate caused by interference and the application layer data verification failure rate, ensuring the accurate transmission of control instructions and feedback information.

[0009] 3. This invention intelligently adjusts software filtering intensity and data retransmission aggressiveness by real-time assessment of interference levels and communication quality. When interference is low and communication quality is good, the complexity of the filtering algorithm can be reduced or unnecessary retransmissions can be minimized, thereby conserving MCU computing resources, reducing bus load and data processing latency. When interference increases, the protection level is automatically strengthened, demonstrating intelligent and efficient resource utilization.

[0010] 4. This invention continuously monitors the interference signature vector and communication quality state vector of the communication link and dynamically adjusts its filtering and transmission control strategies accordingly, enabling the system to automatically adapt to the changing electromagnetic interference characteristics of the charger under different operating modes, load conditions, or external environmental influences. Through collaborative control and learning adjustment mechanisms, the system can also gradually optimize its response strategies in specific interference scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 Schematic diagram of the method flow of the present invention; Figure 2 This is a schematic diagram of the finished product of step one of the present invention; Figure 3 Schematic diagram of the process of TLL to CAN communication filtering of the present invention; Figure 4 Schematic diagram of the circuit of TTLTOCAN of the present invention. DETAILED DESCRIPTION

[0012] The following is combined with Figure 1 , the present invention is described in further detail.

[0013] The present invention provides a TTL-to-CAN communication filtering control method for the charger's internal circuit. By real-time perception of interference and communication quality, dynamic adjustment of software filtering and transmission parameters, and collaborative learning and optimization, the robustness and data accuracy of the charger's internal TTL-to-CAN communication are improved.

[0014] like Figure 1 As shown, the charger internal circuit TTL to CAN communication filtering control method may include the following steps: S1, pre-processing the CAN communication physical link of the charger internal circuit by winding the CAN signal line into a twisted pair and sleeved with a magnetic ring for anti-interference; In this embodiment, the CANH (CAN high) and CANL (CAN low) lines, which carry the CAN differential signal, are intentionally arranged as a twisted pair. These two independent wires are physically tightly and regularly twisted together, extending along their routing paths on the charger's internal circuit board or wiring harness. When coupled to the CAN signal lines, the electromagnetic fields generated by various electromagnetic interference sources within the charger (such as switching power supplies and high-frequency clocks) are coupled. Because the two wires of the twisted pair are located in close proximity and periodically swap relative positions, the noise voltages (i.e., common-mode noise) induced by the interference signal on the two wires (CANH and CANL) tend to be equal in magnitude and phase. When receiving signals, the differential receiver within the CAN transceiver chip subtracts the voltages on the CANH and CANL lines. Since the common-mode noise is approximately the same on both lines, it is significantly offset during the subtraction process, effectively suppressing the potential for common-mode interference to damage the CAN signal. Furthermore, the CAN bus transmits differential signals, with the currents on the CANH and CANL lines flowing in opposite directions and approximately equal in magnitude. The twisted-pair structure enables the magnetic fields generated by the two wires to largely cancel each other out in external space, thereby significantly reducing the electromagnetic energy radiated outward by the CAN communication link itself and reducing the possibility of interference with other sensitive circuits or components inside the charger.

[0015] A magnetic ring is a magnetic component made of a specific ferrite material. It is annular or cylindrical in shape and has a hollow structure that allows cables to pass through it. In the CAN communication link inside the charger, the twisted pair cable consisting of CANH and CANL is passed through the center hole of the selected magnetic ring. The ferrite magnetic ring exhibits a significantly high impedance characteristic for high-frequency common-mode currents, but has little effect on the differential mode CAN communication signal. When the CAN twisted pair carrying high-frequency common-mode noise current passes through the magnetic ring, the high impedance of the magnetic ring effectively curbs the flow of common-mode noise current, just like setting a "filter" or "absorber" on the noise propagation path, converting the high-frequency noise energy into heat energy and dissipating it, or reflecting it back to the noise source, thereby preventing it from continuing to propagate along the signal line and interfering with the CAN transceiver.

[0016] S2. Acquire the current interference characteristic information of the CAN communication link of the charger internal circuit in real time, and quantify the interference characteristic information into an interference characteristic vector; In this embodiment, step S2 is specifically implemented as follows: The core purpose of this step is to accurately perceive the electromagnetic interference environment of the charger's internal CAN communication link in real time and convert these complex interference phenomena into structured data, namely interference feature vectors, providing key decision-making basis for subsequent adaptive filtering strategy selection and communication parameter adjustment.

[0017] This embodiment provides at least two complementary interference feature information acquisition methods, in order to capture interference characteristics from different levels and angles.

[0018] Method 1: Direct sampling and processing based on hardware assistance This method aims to obtain more detailed and direct interference characteristics by directly sampling and analyzing the electromagnetic environment of the CAN communication link or its adjacent area at the physical level.

[0019] In this embodiment, preferably, during the printed circuit board (PCB) layout, a miniaturized pickup probe is placed near sensitive areas of the CAN communication differential line pair (CANH, CANL), or near known strong interference sources (such as the switching power supply module or high-frequency drive circuit inside the charger). The pickup probe can be a miniature loop antenna, a specially designed parallel coupled microstrip line, or other sensing structures suitable for coupling to spatial electromagnetic fields or line-conducted noise.

[0020] The analog noise signal coupled to the pickup probe is fed into an analog-to-digital converter (ADC). The ADC periodically samples the noise signal at a preset sampling frequency, converting it into a discrete digital signal sequence. The sampling frequency should ideally be significantly higher than the baud rate of CAN communication and sufficiently cover the spectrum of the major interfering signals that may exist within the charger to avoid signal aliasing and ensure the effectiveness of subsequent spectrum analysis.

[0021] After acquiring a discrete digital signal sequence, the system performs digital signal processing on the sequence within a short-term analysis window of a preset length to extract specific interference feature data. This feature data may include: Energy distribution value of a specific frequency band (E band,1 ): In order to quantify the intensity of interference energy in a specific sensitive frequency band, the system performs discrete Fourier transform (DFT) or its fast algorithm fast Fourier transform (FFT) on the digital signal sequence within the short-time analysis window to obtain the spectrum distribution of the signal within the time window. Subsequently, for one or more pre-defined key frequency bands that may have a significant impact on the CAN communication quality, the system calculates the frequency spectrum of the signal within the time window. band,i , calculate the energy integral or cumulative sum in this frequency band: E band,i =∑f k ∈Ω band,i |S win [f k ]| 2 ; Where, E band,i is the energy distribution value of the i-th target frequency band; f k is a discrete frequency point; Ω band,iis a set of discrete frequency points representing the i-th target frequency band; S win [f k ] is the discrete frequency point f k The spectrum amplitude of the sampling signal after Fourier transform in the short-time analysis window; |S win [f k ]| 2 At discrete frequency points f k The spectrum energy at .

[0022] By calculating one or more of these E band,i By using the value, we can know which frequency bands the current interference is mainly concentrated in.

[0023] Pulse interference intensity value (I pulse ): In order to characterize the sudden, high-amplitude pulse interference that may exist in the communication link (such as transient noise caused by relay switching, motor start-up and stop, or electrostatic discharge), the system can perform time domain analysis on the sampled digital signal sequence. For example, by detecting whether the maximum peak value of the signal amplitude in the short-term analysis window exceeds a preset threshold, or by counting the number of times or duration that the short-term energy of the signal exceeds a threshold, the intensity or frequency of occurrence of the pulse interference can be quantified. pulse The value can reflect the impact of transient strong interference on the communication link.

[0024] Method 2: Indirect inference based on CAN controller status This method uses the error detection mechanism of the CAN communication protocol itself and the status information provided by the CAN controller hardware to indirectly evaluate communication anomalies caused by interference.

[0025] In this embodiment, the system monitors the status registers of the CAN controller, either integrated within a microcontroller (MCU) or as a standalone chip, in real time. These registers, such as the error counter registers (transmit error counter TEC, receive error counter REC) and the error code register (ECR), can record various physical layer communication error events detected at the CAN protocol level. Common error types include, but are not limited to, bit errors, stuff errors, CRC errors, response errors, and format errors.

[0026] The system is in the preset statistical time window Δt ifp The number of occurrences of one or more (i-th) CAN physical layer errors C err,j Perform cumulative counting and calculate the corresponding error rate R based on the count value err,j The calculation formula is: Where R err,j is the occurrence rate of the jth CAN physical layer error; Cerr,j In the preset time window Δt ifp The number of j-th CAN physical layer errors observed within Δt ifp The length of the preset time window used to count the number of errors.

[0027] By counting these error rates, we can indirectly reflect the degree of damage to the integrity of the CAN bus signal caused by interference.

[0028] The method of the present invention allows for obtaining interference feature data by adopting any of the above-mentioned methods alone, or preferably, adopting both methods simultaneously, so as to obtain a more comprehensive and multi-dimensional description of the interference scenario.

[0029] 2. Interference characteristic vector (V int ) After obtaining one or more of the above original interference feature data, in order to facilitate subsequent intelligent decision-making and algorithm processing, it is necessary to integrate and quantify these discrete feature data into a structured interference feature vector V int .

[0030] In this embodiment, one or more specific interference feature data obtained by the first method and / or the second method are used as components of a vector and are combined in a predetermined order and dimension to form an interference feature vector V int This preset order and dimension ensures the consistency of the vector structure, so that subsequent algorithm modules that rely on this vector can correctly interpret the meaning of its components.

[0031] For example, the interference feature vector V int It can be specifically constituted in one of the following forms or a combination thereof: If the main focus is on the frequency domain and time domain interference characteristics of hardware direct sampling, then V int Can be constructed as: Where: are the energy distribution values ​​of the first to m1th preset key frequency bands of interest, which are the frequency bands that best reflect the characteristics of the interference source determined based on experience or experimental analysis; m1 is the number of preset key frequency bands of interest, which is a positive integer, and its specific value can be adjusted according to the system's requirements for interference detail resolution and computing resource limitations; I pulse is the pulse interference intensity value obtained through time domain analysis.

[0032] If you are primarily interested in the physical layer error statistics reported by the CAN controller, then V int Can be constructed as: Where: R err,m2The occurrence rates of the first to m2 preset CAN physical layer error types of concern, such as bit error rate, stuff error rate, etc.; m2 is the number of preset physical layer error types of concern.

[0033] More preferably, in order to obtain a more comprehensive description of the interference environment, the feature data obtained in the two ways can be combined, for example, V int Can be constructed as [E band,1 ,I pulse ,R err,bit ,R err,stuff ]; where R err,bit represents the bit error rate; R err,stuff Represents the filling error rate.

[0034] S3, evaluating the current communication quality index of the CAN communication link in real time, and quantifying the communication quality index into a communication quality state vector; In this embodiment, step S3, i.e., the process of evaluating the current communication quality index of the CAN communication link in real time and quantifying the communication quality index into a communication quality state vector, is specifically implemented as follows: This step aims to generate a communication quality state vector (CQS) that comprehensively reflects the current health of the CAN communication link by continuously and objectively quantifying the actual operational performance of the CAN communication link. This vector is another key input to the adaptive control mechanism of the present invention. It works in conjunction with the interference signature vector obtained in step S2 to guide subsequent filtering strategy adjustments and transmission parameter optimization.

[0035] Specifically, the evaluation and quantification of communication quality indicators include the following core links: 1. Calculation and Evaluation of Communication Quality Index Data In this embodiment, the microcontroller (MCU) or a dedicated communication monitoring unit in the system performs a statistical evaluation within a preset statistical evaluation period Δt. cqe The activity status of the CAN bus and the transmission interaction of application layer data are continuously monitored within a period of 24 hours, and one or more key communication quality indicators are calculated based on these observation data. cqe The setting of must take into account both the real-time and stability of the evaluation results; a moderate cycle length can smooth out short-term fluctuations while responding promptly to persistent changes in communication quality.

[0036] The present invention preferably evaluates the following communication quality indicators: Error frame rate (R EFR ): This indicator directly reflects the original error level of the CAN bus physical layer and data link layer communication. The microcontroller reads the internal status information of the CAN controller and counts the error in the evaluation period Δt cqeThe number of error frames detected on the CAN bus within C ef The error frame is a special frame defined in the CAN protocol standard. It is sent by any CAN node that detects a protocol error to notify other nodes on the bus that an error has occurred. At the same time, the total number of frames transmitted during the cycle (including valid data frames successfully sent, remote frames, and detected error frames) is counted. tf Error frame rate R EFR This is the ratio of the two: Where: C ef is the statistical evaluation period Δt cqe The total number of error frames detected on the CAN bus within C tf In the same statistical evaluation period Δt cqe The total number of frames attempted to be transmitted on the CAN bus within the specified period (including successful frames and error frames).

[0037] Higher R EFR A value of 0 usually means that the communication link is subject to strong interference or there is a hardware failure, causing frequent errors in the underlying communication protocol.

[0038] Sending success rate (R STR ): This indicator measures the actual delivery capability of CAN messages sent from this node (for example, the MCU inside the charger that executes the method of the present invention). The microcontroller records the actual delivery capability of CAN messages sent from this node (for example, the MCU inside the charger that executes the method of the present invention). cqe The total number of CAN messages attempted to be sent within C at , and at the same time count the number of messages C that are successfully sent and receive a correct response from the receiving node (the ACK bit is correctly set to the dominant level) st . Sending success rate R STR Defined as: Where: C st is the statistical evaluation period Δt cqe The number of CAN messages that this node successfully sends and receives correct responses within C at In the same statistical evaluation period Δt cqe The total number of CAN messages that this node attempts to send within 10 seconds.

[0039] Lower R STR The value may indicate serious bus conflicts, receiving node failures, or corruption of the response signal due to interference, reflecting the reliability of message delivery from the sender to the receiver at the link level.

[0040] Send timeout count (C TO ): This indicator focuses on the situation where the message sending fails to be completed in time due to some reasons. In the evaluation period Δtcqe The microcontroller counts the number of times a message fails to be sent for a specific reason and reaches a preset timeout condition. TO This is the total number of such sending timeout events during the evaluation period. TO A high value indicates that the communication link may be continuously congested, severely interfered with, or have potential hardware connection problems, which may hinder normal communication processes.

[0041] Application layer data verification failure rate (R ADER ): This indicator is used to evaluate whether the application layer data carried by the message still has errors when it is checked at a higher level even if it has passed the CAN underlying protocol check. This is meaningful for detecting specific error modes that may not be fully covered by the CAN standard CRC, or minor errors that may be introduced during the data transfer from the CAN controller to the application layer. In this embodiment, it is assumed that an additional data integrity check mechanism customized by the application is embedded in the application layer data packet. After receiving the message that has passed the CAN physical layer and link layer check, the microcontroller extracts its application layer data and performs this application layer check. During the evaluation period Δt cqe Count the number of packets that fail application layer verification C ade , and the total number of messages C that are successfully received and verified at the application layer during this period rap Application layer data verification failure rate R ADER The calculation is as follows: Where: C ade is the statistical evaluation period Δt cqe The number of packets that failed application layer data verification; C rap In the same statistical evaluation period Δt cqe The total number of packets received and verified at the application layer within .

[0042] A non-zero R ADER A value of 0 indicates that although the CAN link layer communication may appear normal, the integrity of the application data may still be compromised, which may indicate the presence of more subtle forms of interference or data processing issues within the system.

[0043] Through real-time calculation and evaluation of these indicators, the system can grasp the actual operating quality of the current communication link from multiple dimensions.

[0044] 2. Communication Quality State Vector (V cq ) In order to integrate the above multi-dimensional, discrete communication quality index data into a unified structured input that is convenient for subsequent algorithm processing, the present invention quantifies these calculated index data and constructs a communication quality state vector V cq .

[0045] In this embodiment, one or more communication quality indicator data obtained by the above calculations are used as components of a vector and are arranged and combined in an orderly manner according to a preset order and dimension to form a communication quality state vector V cq This standardized vector representation ensures that subsequent processing modules can consistently interpret and use this quality information.

[0046] For example, the communication quality state vector V cq Can be constructed as: V cq =[R EFR ,R STR ,C TO ,R ADER ]; Where R EFR is the error frame rate in the current statistical evaluation period; R STR is the sending success rate in the current statistical evaluation period; C TO R is the sending timeout count value in the current statistical evaluation period; ADER The application layer data verification failure rate during the current statistical evaluation period.

[0047] S4. Based on the interference feature vector and the communication quality state vector, dynamically select at least one filtering algorithm from a preset software filtering strategy library containing multiple algorithms and configure its filtering parameters to filter the data received through the CAN communication link; In this embodiment, step S4 is implemented as follows: This step constitutes one of the core links of the adaptive control strategy of the present invention. Its fundamental purpose is to further improve the accuracy and reliability of received data by adding data filtering function to the application-level software when the underlying physical and link-layer protection mechanisms of the CAN communication link (including the hardware anti-interference measures in the first step and the error detection mechanism of the CAN protocol itself) are still not sufficient to completely eliminate the impact of interference on data content.

[0048] To enable flexible filtering strategy adjustments, the system pre-builds and maintains a library of software filtering strategies within its firmware (typically burned into the microcontroller's (MCU) non-volatile memory). This library integrates a variety of software filtering algorithms designed for different interference types or data characteristics, each with dynamically adjustable parameters. These filtering algorithms operate on successfully received CAN messages that have passed the CAN controller's underlying validation (e.g., CRC, format check, etc.). They further identify, cleanse, or verify the application data carried in these messages before submitting them to upper-layer applications.

[0049] The software filtering strategy library preferably includes one or more of the following algorithms: Duplicate data consistency check algorithm: The core idea of ​​this algorithm is to combat random errors through data redundancy. When the system sends a key data, the sender will intentionally send the same data content N times in a row. consistency times (or sent at different time points and collected by the receiver’s cache). consistency After M data samples are collected, they are compared. consistent The values ​​of the samples are completely consistent (where M consistent is less than or equal to N consistency If the number of consistent samples does not reach M, the system will adopt the same value recognized by the majority of samples as the valid data at the current moment. consistent , it can be determined that the data is invalid in this round of reception, or other error handling mechanisms can be triggered (such as requesting retransmission, using backup values, etc.). The key adjustable parameters of this algorithm are: N consistency : The number of repeated transmissions / receptions. Increasing this value can improve the ability to resist random errors, but it will increase the bus load and the overall delay of data transmission. consistent : The threshold of the number of consistent samples required to determine the validity of the data. For example, when N consistency =3, you can set M consistent =2(Best of Three) or M consistent (Completely consistent.) This algorithm is effective in dealing with occasional interference that may result in a small probability of data tampering.

[0050] Sliding average filtering algorithm: This algorithm is mainly suitable for processing analog data that has a certain degree of continuity but may be interfered by Gaussian white noise or other random fluctuations.

[0051] By calculating the nearest N avg-win The arithmetic mean of the continuous data sampling points is used as the output after filtering at the current moment. The key adjustable parameters are: N avg-win: This refers to the size of the sliding window, representing the number of data points used to calculate the average. A larger window provides stronger smoothing and effectively suppresses high-frequency noise, but it also reduces the system's response to rapid changes in the data and introduces greater signal latency. This algorithm effectively smooths data sequences and filters out random noise.

[0052] Median filter algorithm: This algorithm is also applicable to processing data sequences, and is particularly effective in filtering out sudden impulse noise (spike interference), which may cause data points to have abnormal values ​​far beyond the normal range. The working principle of the median filter is: take the nearest N medianwin Data sample points are sorted, and the value in the middle position after sorting (median) is selected as the output after filtering at the current moment. The key adjustable parameters are: N medianwin : This refers to the window size of the median filter, typically chosen as an odd number (such as 3, 5, or 7) to clearly identify the median. A larger window size improves impulse noise suppression, but also introduces some signal distortion and delay. Because the median filter focuses on its position within the order rather than the specific size of the outliers, it effectively eliminates outliers while preserving signal edges better than a linear smoothing filter.

[0053] Redundancy check code-based error correction or detection algorithms: This algorithm builds on the CRC-15 checksum provided by the CAN protocol by embedding stronger redundancy check information within the application layer data packet. This can be a higher-level cyclic redundancy check (such as CRC-16 or CRC-32) or another code with some error correction capability (such as a simplified Hamming code). Upon receiving the data, the receiver first performs a preliminary check using the CAN controller's hardware CRC. If the checksum passes, it then performs a secondary check using the redundancy check code embedded in the application layer. This approach not only provides stronger error detection (i.e., reduces the rate of missed detections), but in some cases, if error-correcting code is used, it can also attempt to automatically correct the data when even a small number of bit errors are detected, thus restoring data accuracy without requiring retransmissions. Configuration of this algorithm may involve selecting the type of checksum, the generator polynomial, and the level of error correction capability.

[0054] 2. Implementation Mechanism of Dynamic Filtering Strategy Selection and Parameter Configuration One of the core innovations of the present invention is that the software filtering strategy is not statically enabled, but is based on the interference feature vector V perceived in real time. int and the communication quality state vector V cq Perform dynamic selection and parameter configuration.

[0055] Within the system, a dedicated decision logic unit (for example, it can be integrated into the collaborative control unit described in step 6, or as an independent adaptive software filtering strategy module (ASFS)) is responsible for performing this task. The input of the decision logic unit is the latest V int and V cq .

[0056] The decision logic can be implemented based on one or more of the following methods: Preset Rule Set (Rule-Based System): A series of "IF-THEN-ELSE" rules are predefined in the system. The conditional part (IF) of these rules is determined by V int and V cq The result part (THEN / ELSE) specifies the filtering algorithm to be selected and the specific setting values ​​of the algorithm parameters.

[0057] Decision Table: V int and V cq The different state combinations (which may require discretization of continuous values) are used as rows or columns in the decision table, and the cells in the table directly specify the filtering strategy to be adopted under that state combination. The decision table can be pre-designed by domain experts or obtained through offline learning.

[0058] State Machine: The system can define several working states, each state corresponds to a specific filtering strategy configuration. int and V cq The system migrates between these states based on the changes in the state. For example, there can be a "low interference - high quality" state (using lightweight filtering), a "pulse interference - medium quality" state (using median filtering), and a "continuous strong interference - low quality" state (using strong redundancy check and high number of repetition checks).

[0059] The design goal of the decision logic is to: According to the actual interference characteristics (given by V int and the actual performance of the communication link (reflected by V cq The system intelligently selects the filtering algorithm that is most effective in combating the current interference and improving data accuracy, and configures its parameters appropriately. This decision-making logic also needs to consider system resource overhead, such as the microcontroller's computational load and the introduced data processing delay. When interference is low and communication quality is good, filtering intensity can be appropriately reduced to conserve resources. However, when interference is severe and communication quality degrades, filtering measures should be strengthened.

[0060] S5. Dynamically adjust the transmission parameters of the CAN communication link based on the interference characteristic vector and the communication quality state vector, where the transmission parameters include at least the number of data retransmissions; In this embodiment, step S4, i.e., dynamically adjusting the transmission parameters of the CAN communication link based on the interference feature vector and the communication quality state vector, wherein the transmission parameters include at least the number of data retransmissions, is specifically implemented as follows: This step is the adjustment link in the adaptive control strategy of the present invention, directly related to hardware-level communication behavior. Its core goal is to enable the communication system to proactively adapt to the interference environment and actual communication performance assessed in steps S2 and S3 by intelligently modifying certain key transmission parameters controlled by the CAN communication protocol stack or application layer in real time, thereby achieving a dynamic balance between ensuring data transmission success rate and controlling bus load.

[0061] 1. Necessity and Basis for Dynamically Adjusting Transmission Parameters In the complex electromagnetic environment inside a charger, fixed communication transmission parameters often struggle to adapt to time-varying interference conditions. For example, in strong interference environments, a low default retransmission count can easily lead to message abandonment after repeated transmission failures. Conversely, in weak interference environments, excessively high retransmission counts can unnecessarily increase bus load and message latency. Therefore, this invention introduces a dynamic transmission parameter adjustment mechanism based on real-time feedback.

[0062] The direct basis for the adjustment is the interference feature vector obtained in step S2 and the communication quality state vector obtained in step S3. These two vectors together provide the decision module with a comprehensive view of the current "external environment pressure" and "internal performance".

[0063] 2. Key Adjustable Transmission Parameters and Their Adjustment Logic In this embodiment, at least the following transmission parameters are dynamically adjusted: Dynamically adjust the maximum number of retransmissions allowed after a CAN message fails to send: The CAN communication protocol itself usually supports a certain number of automatic retransmissions after a message fails to send (such as an error, arbitration loss, or no response is received).

[0064] On this basis, the present invention dynamically adjusts the maximum allowed number of retransmissions.

[0065] The core idea of ​​the adjustment logic is: when the communication quality deteriorates or the interference increases, appropriately increase the retransmission opportunities to improve the probability of the message being successfully delivered; when the communication quality is good or the interference is reduced, appropriately reduce unnecessary retransmissions to reduce the bus load, reduce potential sending congestion, and save processing resources of the sending node.

[0066] Specifically, the decision logic unit analyzes Vint and V cq The relevant components of: For example, if V cq The sending success rate (R STR ) continues to be low, while sending the timeout count (C TO ) increases significantly, which usually indicates that the message is facing great difficulty. At this time, the system can decide to increase C retrans-max The value of .

[0067] On the contrary, if R STR At a high level for a long time, C TO Very low, and V int This indicates that the current interference level is low, so the system can consider reducing C appropriately. retrans-max , even in extremely good conditions, set it to a lower baseline value.

[0068] Through C retrans-max With dynamic management, the system can more effectively utilize bus bandwidth and avoid unnecessary retransmissions while ensuring communication reliability.

[0069] Dynamically adjust the retransmission time interval: In addition to adjusting the number of retransmissions, in some implementations, the time interval T before the next retransmission attempt is initiated after a message fails to be sent can also be adjusted. retrans-interval Make dynamic adjustments.

[0070] This adjustment is particularly applicable when the interference feature vector V obtained in step S2 is int It can reveal situations where interference has certain periodic or time-specific distribution characteristics. For example, by performing spectrum analysis (such as FFT) on the noise signal sampled by the hardware, a strong periodic interference source with a specific frequency (for example, a noise peak generated by a switching power supply at a specific phase) can be identified.

[0071] In this case, the decision logic can try to optimize the timing of retransmission. When a transmission fails, the system does not retransmit immediately or after a fixed delay, but according to V int The interference period information provided can be used to selectively schedule the next retransmission within a "window period" when the expected interference is relatively weak. This may involve estimating or tracking the phase of the interfering signal.

[0072] For example, if an impulse interference synchronized with a fixed frequency is detected, the system can attempt to schedule retransmissions during the expected intervals between the impulse interferences.

[0073] By intelligently selecting the retransmission time point, the probability of successful retransmission can be increased, thereby improving the overall communication performance without significantly increasing the total number of retransmissions. This is a more refined interference avoidance strategy.

[0074] III. Decision-making and Implementation Mechanism The adjustment decision of dynamic transmission parameters is also made by the decision logic unit within the system based on V int and V int The decision logic may be implemented in a similar manner to step S3, such as based on preset rules, a decision table, or a state machine.

[0075] Once the decision module determines the new transmission parameter values, it will instruct the relevant communication control module (which may be part of the CAN driver or the transmission management logic of the application layer) to apply these new parameter settings. These settings will take effect in the subsequent CAN message transmission process.

[0076] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. The charger internal circuit TTL to CAN communication filter control method is characterized by: The following steps are involved: S1. The CAN communication physical link of the charger's internal circuit is pre-processed for anti-interference by twisting the CAN signal line into a twisted pair and sleeved with a magnetic ring; S2. Acquire current interference characteristic information of the CAN communication link of the charger internal circuit in real time, and quantify the interference characteristic information into an interference characteristic vector; S3. Evaluate the current communication quality index of the CAN communication link in real time, and quantify the communication quality index into a communication quality state vector; S4. Based on the interference feature vector and the communication quality state vector, dynamically select at least one filtering algorithm from a preset software filtering strategy library containing multiple algorithms and configure its filtering parameters to filter the data received through the CAN communication link; S5. Based on the interference characteristic vector and the communication quality state vector, dynamically adjust the transmission parameters of the CAN communication link, where the transmission parameters at least include the number of data retransmissions.

2. The charger internal circuit TTL to CAN communication filtering control method according to claim 1, characterized in that: In step S2, obtaining the current interference characteristic information includes at least one of the following methods: The noise signal coupled to the CAN communication link or its adjacent area is sampled by a hardware sampling module, and the sampled signal is digitally processed to extract the interference characteristic information, which includes the energy distribution E of a specific frequency band. band,1 or pulse interference characteristic I pulse ; By monitoring the CAN controller status, statistics of physical layer error types and their occurrence rates R err,1 as the interference characteristic information; The interference features extracted and / or the interference features statistically analyzed are used as components to form the interference feature vector V int : The interference feature vector V int Can be constructed as or Or their combination, where m1 is the number of key frequency bands of concern, m2 is the number of error types of concern; E band,1 , are the energy distribution values ​​of the first to m1th preset key frequency bands of interest; I pulse is the pulse interference intensity value obtained through time domain analysis; The occurrence rate of the first to m2 preset CAN physical layer error types of concern.

3. The charger internal circuit TTL to CAN communication filter control method according to claim 2, characterized in that: In step S3, evaluating the current communication quality index includes calculating at least one of the following: error frame rate R EFR , sending success rate R STR , Send timeout count C TO , application layer data verification failure rate R ADER ; The calculated one or more communication quality indicator data are used as components to form the communication quality state vector V cq The communication quality state vector V cq Can be constructed as [R EFR ,R STR ,C TO ,R ADER ]; where R EFR is the error frame rate in the current statistical evaluation period; R STR is the sending success rate in the current statistical evaluation period; C TO R is the sending timeout count value in the current statistical evaluation period; ADER The application layer data verification failure rate during the current statistical evaluation period.

4. The charger internal circuit TTL to CAN communication filtering control method according to claim 3, characterized in that: In step S4, dynamically selecting at least one filtering algorithm from the software filtering strategy library and configuring its filtering parameters include: According to the interference characteristic vector and the communication quality state vector, selection and configuration are performed through a preset decision logic, wherein the decision logic selection includes at least one or more of the following: Duplicate data consistency check algorithm, sliding average filter algorithm, median filter algorithm, error correction or error detection algorithm based on redundant check code; the filtering parameters include the number of checks for duplicate data consistency check or the window size of the filtering algorithm.

5. The charger internal circuit TTL to CAN communication filter control method according to claim 4, characterized in that: In step 5S, dynamically adjusting the transmission parameters of the CAN communication link includes: dynamically adjusting the maximum allowed number of retransmissions and the retransmission time interval after a CAN message fails to be sent according to the interference characteristic vector and the communication quality state vector.

6. The charger internal circuit TTL to CAN communication filter control method according to claim 5, characterized in that: The method further comprises a collaborative control step, which is performed by a collaborative control unit and includes: receiving the interference characteristic vector and the communication quality state vector; Based on a preset system overall utility function, coordinating the filtering algorithm selection and filtering parameter configuration in step S3 and the transmission parameter adjustment in step S4 to optimize the system overall utility function; Among them, the overall utility function of the system is: U sys Comprehensive consideration of sending success rate: R STR , Error frame rate: R EFR 、Microcontroller average load: L mcu-avg and average bus load: L bus-avg , whose expression is: U sys =a str ·R STR -b efr ·R EFR -c mcu ·L mcuavg -d bus ·L busavg ; Where U sys is the overall utility function value of the system; R STR is the sending success rate; R EFR is the error frame rate; L mcu-avg is an estimate of the average load of the microcontroller; L bus-avg is the estimated value of the average bus load; α str is the preset weight coefficient of the sending success rate; β efr is the preset weight coefficient of the error frame rate; γ mcu is the preset weight coefficient of the average load of the microcontroller; bus The preset weight coefficient for the average bus load.

7. The charger internal circuit TTL to CAN communication filtering control method according to claim 6, characterized in that: The collaborative control step further includes a learning adjustment mechanism, which includes: Record historical interference feature vectors, communication quality state vectors, selected filtering algorithms and filtering parameters, adjusted transmission parameters, and the overall system utility value generated by their combination; By making exploratory minor adjustments to the currently selected filtering algorithm and filtering parameters or transmission parameters, and evaluating the impact of the adjustments on the overall utility value of the system; If the adjustment improves the overall utility value of the system, the adjustment is adopted; otherwise, other adjustments are restored or tried, so that the method can gradually accumulate experience and optimize its control strategy.

8. The charger internal circuit TTL to CAN communication filter control method according to claim 7, characterized in that: When the interference feature information is extracted by the hardware sampling module, the energy distribution E of the specific frequency band band,i , the spectrum amplitude S is obtained by performing discrete Fourier transform or fast Fourier transform on the sampled signal in a short time analysis window win [f k ], and the target frequency band Ω band,i The energy of the spectral components within is calculated by summing up: Where, E band,i is the energy distribution value of the i-th target frequency band; f k is a discrete frequency point; Ω band,i is a set of discrete frequency points representing the i-th target frequency band; S win [f k ] is the discrete frequency point f k The spectrum amplitude of the sampling signal after Fourier transform in the short-time analysis window; |S win [f k ]| 2 At discrete frequency points f k The spectrum energy at .

9. The charger internal circuit TTL to CAN communication filtering control method according to claim 8, characterized in that: When the physical layer error type and its occurrence rate are counted by monitoring the CAN controller status as interference feature information, the occurrence rate of the jth CAN physical layer error R err,j , by setting the time window Δt ifp Internal statistics of the number of times this error occurs C err,j Calculation yields: Where R err,j is the occurrence rate of the jth CAN physical layer error; C err,j In the preset time window Δt ifp The number of j-th CAN physical layer errors observed within Δt ifp The length of the preset time window used to count the number of errors.