Control method of charging module with master-slave single-chip microcomputers and computer equipment
By adopting the master-slave microcontroller architecture in the charging module, the main microcontroller is responsible for system decision-making and management, and the slave microcontroller is responsible for data acquisition and specific control, the performance bottleneck of the microcontroller architecture in complex charging management tasks is solved, and the charging module is efficient, stable and safe operation is achieved.
Patent Information
- Application Number
- CN202510106578.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-06
AI Technical Summary
The microcontroller architecture in the existing charging module has performance bottlenecks when handling complex charging management tasks, including low multi-task scheduling efficiency, slow response speed, untimely fault emergency response and poor scalability, making it difficult to meet the efficient, stable and safe operation needs of modern charging modules.
The master-slave microcontroller architecture is adopted, and the main microcontroller is responsible for decision logic and state management. Through cooperation with the slave microcontroller, the master-slave microcontroller is clear in division of labor, the main microcontroller is responsible for the global control of the system, and the slave microcontroller is responsible for data collection and specific control tasks, so as to achieve efficient management and protection of the charging module.
Through the collaborative work of the master-slave microcontroller, the working efficiency and response speed of the charging module are significantly improved, and it can maintain efficient operation in complex environments, ensuring high stability and safety of the system, reducing the risk of failure and upgrading and maintenance costs.
Smart Images

Figure CN119944895A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of charging module control design, and in particular to a charging module control method with a master-slave single-chip microcomputer and a computer device. Background Art
[0002] With the widespread application of power energy storage systems, charging modules play an important role in ensuring power supply and achieving efficient charging management. The charging module needs to efficiently manage the battery charging process, control current, voltage and temperature, and ensure the stability and safety of the charging process. To this end, the charging module usually integrates multiple control strategies and protection mechanisms.
[0003] However, existing charging modules are generally controlled by single-chip microcomputers (MCUs). The single MCU architecture exposes obvious limitations when handling complex charging management tasks. First, since all tasks are handled by a single MCU, as the system functions increase, the control process of the MCU becomes complicated, and it is difficult to efficiently handle multiple concurrent tasks, resulting in slow system response and obvious performance bottlenecks. Secondly, the processing power of the single-chip microcomputer is limited, and it is unable to respond to high-frequency tasks in real time, such as monitoring and adjusting voltage, current, and temperature. This may cause the system to be unable to take protective measures in time under abnormal circumstances, increasing the risk of system failure. In addition, the existing system has poor scalability. When new functions need to be added or more modules need to be supported, it is difficult to respond flexibly, and the system upgrade and maintenance costs are high.
[0004] Therefore, the single MCU architecture in the existing technology has bottlenecks in multi-task scheduling, response speed, fault emergency processing and expansion capabilities, and it is difficult to meet the requirements of modern charging modules in terms of efficient, stable and safe operation. Summary of the invention
[0005] The embodiment of the present application provides a charging module control method and a computer device with a master-slave single-chip microcomputer. The technical solution is as follows:
[0006] According to one aspect of the present application, a charging module control method is provided, the method being applicable to a main single-chip microcomputer, the method comprising:
[0007] Start after power-on and perform initialization operations;
[0008] Select the working mode of the charging module according to external input or preset parameters;
[0009] In response to detecting an abnormal AC input, entering a protection mode and stopping charging output;
[0010] Performing logic processing according to the current working state of the charging module to generate an output adjustment instruction, and sending it to the slave microcontroller for execution, wherein the output adjustment instruction is used to instruct the slave microcontroller whether to adjust the PWM duty cycle;
[0011] Collect bus voltage regularly, and detect temperature data collected by the temperature sensor at the main microcontroller in real time;
[0012] Determining whether the system temperature exceeds a safe range according to the temperature data;
[0013] In response to detecting that the temperature exceeds a set threshold or an abnormal condition, the direct current DC output of the charging module is cut off.
[0014] Optionally, the starting after power-on and performing initialization operations include:
[0015] Start up after power-on, configure the system clock, initialize peripherals, configure the communication interface, and initialize variables and state machines.
[0016] Optionally, in response to detecting that the alternating current (AC) input is abnormal, entering a protection mode and stopping charging output includes:
[0017] Detect the input status of AC and determine whether the input voltage is within the allowable range;
[0018] In response to abnormal AC input, it enters protection mode and stops charging output.
[0019] Optionally, the method further includes:
[0020] Monitor the output status of the charging circuit and make real-time adjustments based on the output status.
[0021] Optionally, in response to detecting that the temperature exceeds a set threshold or an abnormal condition, cutting off the direct current DC output of the charging module includes:
[0022] In response to detecting that the temperature exceeds a set threshold, or that the input is over-voltage or under-voltage, or that the total power of multiple single-channel outputs exceeds the rated power, the direct current DC output of the charging module is cut off.
[0023] According to another aspect of the present application, a charging module control method is provided, the method being applicable to a single chip microcomputer, the method comprising:
[0024] Start after power-on and perform initialization operations;
[0025] In response to receiving an output adjustment instruction sent from the main single-chip microcomputer, determining whether to adjust the PWM duty cycle according to the output adjustment instruction;
[0026] Periodically collect the working status of the charging module, including collecting the ADC sampling values of the voltage and current of the charging module and the sampling values of the temperature sensor;
[0027] Real-time detection of temperature data collected from the temperature sensor at the single-chip microcomputer;
[0028] In response to detecting that the temperature exceeds a set threshold, the DC output of the charging module is cut off.
[0029] Optionally, the starting after power-on and performing initialization operations include:
[0030] Start after power-on, configure ADC sampling channels, initialize PWM output channels, and initialize interrupt services;
[0031] After initialization is completed, wait for instructions from the main microcontroller.
[0032] Optionally, the method further includes:
[0033] In response to detecting that the DC output voltage and output current of the charging module are abnormal, a protection operation is independently performed and the PWM output is stopped, the output voltage and output current abnormalities include short circuit and overcurrent of a single output channel, and the protection operation includes short circuit protection and overcurrent protection of a single output channel.
[0034] On the other hand, a computer device is provided, which includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the charging module control method with master-slave microcontrollers as described in the above aspect.
[0035] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the charging module control method with a master-slave single-chip microcomputer as described in the above aspect.
[0036] On the other hand, a computer program product is also provided, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the charging module control method with master-slave microcontrollers described in the above aspect.
[0037] The technical effects brought about by this application include at least:
[0038] The embodiment of the present application provides a charging module control method with a master-slave single-chip microcomputer, and the division of labor and cooperation between the master single-chip microcomputer and the slave single-chip microcomputer significantly improves the working efficiency and response speed of the charging module. The master single-chip microcomputer can accurately configure the system clock, peripherals and communication interface in the initialization phase by starting synchronously with the slave single-chip microcomputer, and ensure that the task allocation of the master and slave single-chip microcomputers is clear. The master single-chip microcomputer is responsible for decision logic and state management, and selects the working mode of the charging module according to external input or preset parameters to ensure the adaptability and stability of the system in different working environments. When the system detects that the AC input is abnormal, the master single-chip microcomputer responds quickly and switches to the protection mode, stops the charging output, and avoids damage to the equipment due to abnormal voltage. In addition, the master single-chip microcomputer controls the charging output power by generating output adjustment instructions, and regularly collects bus voltage and temperature data to monitor the system status in real time. In this way, the master single-chip microcomputer can efficiently manage the overall operation of the system and ensure the stability and safety of the charging process. Even if the temperature is too high or the voltage is abnormal, the master single-chip microcomputer can cut off the DC output in time to avoid further damage to the system. Through the collaboration between the master MCU and the slave MCU, the charging module can maintain efficient operation in the face of complex environments and multi-tasking concurrency, and ensure high stability and security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of a charging module control method with a master-slave single-chip microcomputer provided by an exemplary embodiment of the present application is shown;
[0040] Figure 2 A structural block diagram of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0041] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0042] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0043] First, let me introduce Figure 1 , Figure 1 The schematic diagram of the master-slave single-chip microcomputer controlling the charging module is shown below. Figure 1 Provide explanation.
[0044] Example 1
[0045] According to one aspect of the present application, a charging module control method is provided, the method is applicable to a main single chip computer, and the method includes:
[0046] Step 101, start after power-on and perform initialization operation.
[0047] After power-on, it starts up, configures the system clock, initializes peripherals (such as ADC, PWM), configures communication interfaces (such as I 2 C, SPI, etc.) and initialize variables and state machines. 2 C, SPI or UART and other communication protocols, to achieve data transmission and command interaction between the master MCU and the slave MCU, to ensure the stable operation of the system.
[0048] The hardware circuit determines which microcontroller is powered first and starts running the internal program. If the slave microcontroller starts first, its actions are also determined by the instructions of the master microcontroller.
[0049] Step 102, selecting the working mode of the charging module according to external input or preset parameters.
[0050] The main MCU selects the appropriate operating mode according to the DIP switch status or user instructions, and adjusts the output control according to the selected mode. This operation ensures that both are controlled in the same operating mode after power-on through the communication mechanism.
[0051] Step 103 , in response to detecting that the alternating current (AC) input is abnormal, entering a protection mode and stopping charging output.
[0052] Detect the AC input status and determine whether the input voltage is within the allowable range. In response to abnormal AC input, enter the protection mode and stop charging output.
[0053] In one example, the main MCU continuously detects the AC input voltage and determines whether it is within the allowable range. If the input voltage is abnormal (such as undervoltage, overvoltage), the system will immediately enter the protection mode and cut off the charging output to prevent damage to the battery or system.
[0054] Step 104, performing logic processing according to the current working state of the charging module to generate an output adjustment instruction, and sending it to the slave microcontroller for execution.
[0055] The output adjustment instruction is used to instruct the slave microcontroller whether to adjust the PWM duty cycle.
[0056] The master MCU processes the working logic according to the current state of the system and generates an output adjustment instruction indicating whether to adjust the PWM duty cycle, and sends it to the slave MCU for execution. By adjusting the PWM duty cycle, the slave MCU controls the output of the charging current.
[0057] In one example, the master MCU sends an output adjustment instruction to decide whether the slave MCU should output. The slave MCU decides whether to adjust the PWM output based on the result of such a logical processing.
[0058] Step 105 , regularly collecting bus voltage, and performing real-time detection on temperature data collected by the temperature sensor at the main single-chip computer.
[0059] The main MCU periodically obtains temperature data and bus voltage data from the slave MCU to ensure that the working status of the charging module is always within the controllable range. The main MCU is responsible for processing and evaluating the collected data and making decisions as needed.
[0060] In addition, at this stage, it also includes monitoring the output status of the charging circuit and making real-time adjustments based on the output status. The main microcontroller can also adjust the output current based on feedback from the slave microcontroller to achieve more precise charging control.
[0061] Among them, the main microcontroller has bus voltage overvoltage protection. The purpose of collecting the bus voltage is to start the protection when the bus is overvoltage.
[0062] Step 106: determine whether the system temperature exceeds a safe range based on the temperature data.
[0063] The main microcontroller determines the current system temperature based on the data from the temperature sensor. If the temperature exceeds the safety threshold, the system will enter protection mode.
[0064] Step 107 , in response to detecting that the temperature exceeds a set threshold or an abnormal condition, cutting off the DC output of the charging module.
[0065] In response to detecting that the temperature exceeds the set threshold, or the input is over-voltage or under-voltage, or the total power of multiple single-channel outputs exceeds the rated power, the DC output of the charging module is cut off. That is, when the temperature is too high, too low, or the voltage is abnormal, the main microcontroller will cut off the charging output from the microcontroller to prevent further damage to the device or battery.
[0066] In summary, in Example 1, the division of labor and cooperation between the master single-chip microcomputer and the slave single-chip microcomputer significantly improves the working efficiency and response speed of the charging module. The master single-chip microcomputer can accurately configure the system clock, peripherals and communication interface in the initialization phase by starting synchronously with the slave single-chip microcomputer, and ensure that the task allocation of the master and slave single-chip microcomputers is clear. The master single-chip microcomputer is responsible for decision logic and state management, and selects the working mode of the charging module according to external input or preset parameters to ensure the adaptability and stability of the system in different working environments. When the system detects that the AC input is abnormal, the master single-chip microcomputer responds quickly and switches to the protection mode, stops the charging output, and avoids damage to the equipment due to abnormal voltage. In addition, the master single-chip microcomputer controls the charging output power by generating output adjustment instructions, and regularly collects bus voltage and temperature data to monitor the system status in real time. In this way, the master single-chip microcomputer can efficiently manage the overall operation of the system and ensure the stability and safety of the charging process. Even if the temperature is too high or the voltage is abnormal, the master single-chip microcomputer can cut off the DC output in time to avoid further damage to the system. Through the collaboration between the master MCU and the slave MCU, the charging module can maintain efficient operation in the face of complex environments and multi-tasking concurrency, and ensure high stability and security of the system.
[0067] Example 2
[0068] According to another aspect of the present application, a charging module control method is provided, the method is applicable to a single chip microcomputer, and the method includes:
[0069] Step 201, start after power-on and perform initialization operation.
[0070] After power-on, it starts to configure the ADC sampling channel, initialize the PWM output channel, and initialize the interrupt service. After the initialization is completed, it waits for the instruction of the main microcontroller. 2 C or SPI protocol, the instruction transmission between the master and slave microcontrollers ensures the stable and coordinated operation of the system.
[0071] Step 202: In response to receiving an output adjustment instruction sent from a main microcontroller, determine whether to adjust the PWM duty cycle according to the output adjustment instruction.
[0072] The slave MCU receives the output adjustment instructions from the master MCU and controls the current and voltage of the charging output according to the instructions to ensure the efficient operation of the charging module.
[0073] Step 203: periodically collect the working status of the charging module.
[0074] Including collecting the ADC sampling values of the voltage and current of the charging module and the sampling values of the temperature sensor.
[0075] The slave microcontroller periodically collects the battery voltage, current, and temperature data and transmits the data to the master microcontroller for subsequent processing.
[0076] Step 204: Real-time detection of the temperature data collected from the temperature sensor at the single-chip microcomputer.
[0077] The temperature data is independently monitored in real time from the MCU to ensure that the system operating temperature is always within a safe range.
[0078] Step 205 , in response to detecting that the temperature exceeds a set threshold, cutting off the DC output of the charging module.
[0079] When the temperature data detected from the MCU exceeds the set safety threshold, it will perform a protection operation and immediately cut off the DC output of the charging module to prevent damage to the equipment.
[0080] Optionally, the method also includes exception handling content.
[0081] In response to detecting abnormalities in the DC output voltage and output current of the charging module, protection operations are independently performed and PWM output is stopped. The output voltage and output current abnormalities include short circuit and overcurrent of a single output channel. The protection operations include short circuit protection and overcurrent protection of a single output channel.
[0082] Therefore, the slave MCU independently performs short-circuit protection and over-current protection. When abnormal voltage and current are detected, the corresponding output channel is closed to prevent further damage to the system. At the same time, the slave MCU will feedback abnormal information to the master MCU, and the master MCU will take corresponding remedial measures.
[0083] In summary, in Example 2, the slave microcontroller is independently responsible for data acquisition, PWM regulation and protection mechanism when executing the charging module control. By starting synchronously with the master microcontroller, the slave microcontroller can configure the necessary hardware, such as ADC sampling channel and PWM output channel, in the initialization stage, and after receiving the master microcontroller instruction, accurately control the output power of the charging module according to the output regulation instruction. This division of labor allows the slave microcontroller to focus on rapid response and execution of specific control tasks, improving the processing speed and responsiveness of the entire system. The slave microcontroller periodically collects parameters such as voltage, current and temperature, and performs protection operations based on real-time monitoring data to ensure safety during the charging process. When it is detected that the temperature exceeds the set threshold, the slave microcontroller can immediately trigger the protection mechanism, cut off the output of the charging module, and prevent overheating from causing damage to the equipment. Furthermore, the slave microcontroller can independently perform short-circuit and overcurrent protection to ensure that the system can respond in time and stop PWM output when an abnormality occurs. The master microcontroller further makes system recovery or status updates based on the feedback from the slave microcontroller. Through this master-slave division of labor and collaboration design, the system not only improves real-time response capabilities, but also enhances fault handling capabilities, ensuring the stability and reliability of the charging module in complex environments.
[0084] In summary, in Example 1 and Example 2, through the collaborative working mode of the master and slave microcontrollers, the master microcontroller is responsible for the overall control decision-making and management to ensure the stable operation of the system in a complex charging environment, while the slave microcontroller focuses on the execution of specific tasks, including data acquisition, PWM regulation and rapid response of the protection mechanism. The master and slave microcontrollers are connected via I 2 C, SPI and other communication protocols to transmit data to ensure the real-time and accuracy of information transmission. During the data acquisition process, the division of tasks between the master MCU and the slave MCU avoids data inconsistency, and ensures the safety and efficiency of the charging process by giving priority to key data (such as temperature sensor data). The dual protection mechanism (temperature protection, overcurrent protection, short-circuit protection) mentioned in the embodiment further improves the reliability of the charging module. In the event of a fault, the system can respond quickly and return to a safe state.
[0085] Please refer to Figure 2 , which shows a block diagram of a computer device 900 provided by an exemplary embodiment of the present application. The computer device 900 may be an electronic device such as a smart phone, a tablet computer, an e-book, a portable personal computer, etc., which has an application installed and running. The computer device 900 in the present application may include one or more of the following components: a processor 910, a memory 920, and a screen 930.
[0086] The processor 910 may include one or more processing cores. The processor 910 uses various interfaces and lines to connect various parts of the entire computer device 900, and executes various functions and processes data of the computer device 900 by running or executing instructions, programs, code sets or instruction sets stored in the memory 920, and calling data stored in the memory 920. Optionally, the processor 910 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 910 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the screen 930; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 910, but may be implemented separately through a communication chip.
[0087] The memory 920 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 920 includes a non-transitory computer-readable storage medium. The memory 920 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 920 may include a storage program area and a storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system (including a system deeply developed based on an Android system), an IOS system developed by Apple (including a system deeply developed based on an IOS system) or other systems. The storage data area may also store data (such as a phone book, audio and video data, chat record data) created by the computer device 900 during use.
[0088] The screen 930 may be a touch display screen, which is used to receive a touch operation on or near it by a user using any suitable object such as a finger or a touch pen, and to display the user interface of each application. The touch display screen is usually arranged on the front panel of the computer device 900. The touch display screen may be designed as a full screen, a curved screen, or a special-shaped screen. The touch display screen may also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
[0089] An embodiment of the present application also provides a computer-readable medium, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the charging module control method with master-slave microcontrollers as described in the above embodiments.
[0090] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A charging module control method, characterized in that: The method is applicable to a main single-chip microcomputer, and the method comprises: Start after power-on and perform initialization operations; Select the working mode of the charging module according to external input or preset parameters; In response to detecting an abnormal AC input, entering a protection mode and stopping charging output; Performing logic processing according to the current working state of the charging module to generate an output adjustment instruction, and sending it to the slave microcontroller for execution, wherein the output adjustment instruction is used to instruct the slave microcontroller whether to adjust the PWM duty cycle; Collect bus voltage regularly, and detect temperature data collected by the temperature sensor at the main microcontroller in real time; Determining whether the system temperature exceeds a safe range according to the temperature data; In response to detecting that the temperature exceeds a set threshold or an abnormal condition, the direct current DC output of the charging module is cut off.
2. The method according to claim 1, characterized in that The power-on startup and initialization operation include: Start synchronously with the slave MCU, configure the system clock, initialize peripherals, configure the communication interface, and initialize variables and state machines.
3. The method according to claim 1, characterized in that In response to detecting that the alternating current (AC) input is abnormal, entering a protection mode and stopping charging output comprises: Detect the input status of AC and determine whether the input voltage is within the allowable range; In response to abnormal AC input, it enters protection mode and stops charging output.
4. The method according to claim 1, characterized in that: The method further comprises: Monitor the output status of the charging circuit and make real-time adjustments based on the output status.
5. The method according to claim 1, characterized in that In response to detecting that the temperature exceeds a set threshold or an abnormal condition, cutting off the DC output of the charging module comprises: In response to detecting that the temperature exceeds a set threshold, or that the input is over-voltage or under-voltage, or that the total power of multiple single-channel outputs exceeds the rated power, the direct current DC output of the charging module is cut off.
6. A charging module control method, characterized in that: The method is applicable to a single chip microcomputer, and the method comprises: Start after power-on and perform initialization operations; In response to receiving an output adjustment instruction sent from the main single-chip microcomputer, determining whether to adjust the PWM duty cycle according to the output adjustment instruction; Periodically collect the working status of the charging module, including collecting the ADC sampling values of the voltage and current of the charging module and the sampling values of the temperature sensor; Real-time detection of temperature data collected from the temperature sensor at the single-chip microcomputer; In response to detecting that the temperature exceeds a set threshold, the DC output of the charging module is cut off.
7. The method according to claim 6, characterized in that The power-on startup and initialization operation include: Start after power-on, configure ADC sampling channels, initialize PWM output channels, and initialize interrupt services; After initialization is completed, wait for instructions from the main microcontroller.
8. The method according to claim 6, characterized in that The method further comprises: In response to detecting that the DC output voltage and output current of the charging module are abnormal, a protection operation is independently performed and the PWM output is stopped, the output voltage and output current abnormalities include short circuit and overcurrent of a single output channel, and the protection operation includes short circuit protection and overcurrent protection of a single output channel.
9. A computer device, characterized in that: The computer device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the charging module control method as described in any one of claims 1 to 5, or to implement the charging module control method as described in any one of claims 6 to 8.