A baud rate setting method, apparatus, device, and storage medium
By identifying the baud rate valid flag information in the preset memory of the target control unit, the target baud rate strategy is determined and set, which solves the problem of the single baud rate setting method in the prior art and realizes adaptability and communication stability in different scenarios.
Patent Information
- Application Number
- CN202310313189.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2043-03-28
AI Technical Summary
Existing technologies use a single baud rate setting method, which cannot be applied to different scenarios, resulting in an inability to effectively match and adapt to different scenarios.
By identifying the preset baud rate validity flag information in the preset memory of the target control unit, the target baud rate setting strategy is determined, and the target baud rate is set according to the strategy to adapt to the needs of different scenarios.
The baud rate setting methods have been enriched, the adaptability in different scenarios has been improved, and normal communication between the target control unit and the associated data transmission object has been ensured.
Smart Images

Figure CN116455694B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle diagnostic technology, and more particularly to a baud rate setting method, apparatus, device, and storage medium. Background Technology
[0002] To improve the communication speed of the vehicle's network, automakers often adjust the baud rate of the vehicle's Electronic Control Unit (ECU) during installation. Correspondingly, to ensure that the target control unit can communicate normally with the ECU, the baud rates of the two need to be kept consistent, which means that the baud rate of the ECU needs to be re-identified.
[0003] Existing technologies offer only one way to set the baud rate, making it impossible to adjust the baud rate appropriately for different scenarios. Summary of the Invention
[0004] This invention provides a baud rate setting method, apparatus, device, and storage medium, which can enrich baud rate setting methods, match appropriate baud rate setting methods according to different scenarios, and improve adaptability to different scenarios.
[0005] In a first aspect, embodiments of the present invention provide a baud rate setting method, the method comprising:
[0006] Identify the preset baud rate valid flag information in the preset memory of the target control unit to obtain the baud rate valid flag information identification result;
[0007] Based on the baud rate valid flag information identification result, the target baud rate setting strategy of the target control unit matching the associated data transmission object is determined;
[0008] The target baud rate of the target control unit is set according to the target baud rate setting strategy.
[0009] Secondly, embodiments of the present invention provide a baud rate setting device, the device comprising:
[0010] The baud rate valid flag information recognition module is used to recognize the preset baud rate valid flag information in the preset memory of the target control unit and obtain the baud rate valid flag information recognition result;
[0011] The baud rate setting strategy determination module is used to determine the target baud rate setting strategy of the target control unit that matches the associated data transmission object based on the baud rate valid flag information identification result;
[0012] The baud rate setting module is used to set the target baud rate of the target control unit according to the target baud rate setting strategy.
[0013] Thirdly, embodiments of the present invention provide a computer device, the computer device comprising:
[0014] One or more processors;
[0015] Memory, used to store one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the baud rate setting method described in any embodiment.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the baud rate setting method described in any embodiment.
[0018] The technical solution provided by this invention identifies preset baud rate valid flag information in the preset memory of the target control unit to obtain a baud rate valid flag information identification result; based on the baud rate valid flag information identification result, a target baud rate setting strategy matching the associated data transmission object for the target control unit is determined; and the target baud rate of the target control unit is set according to the target baud rate setting strategy. This invention solves the problem that existing technologies offer only one method for setting baud rates, making them unsuitable for different scenarios. It enriches the baud rate setting methods, allowing for the matching of appropriate baud rate setting methods to different scenarios, thus improving adaptability to various situations. Attached Figure Description
[0019] Figure 1 This is a flowchart of a baud rate setting method provided in an embodiment of the present invention;
[0020] Figure 2 This is a flowchart illustrating a DCU installation process provided by an embodiment of the present invention;
[0021] Figure 3 This is a flowchart of a baud rate setting method provided in an embodiment of the present invention;
[0022] Figure 4 This is a flowchart illustrating a process for setting baud rate valid flag information according to an embodiment of the present invention;
[0023] Figure 5 This is a flowchart illustrating a baud rate setting process provided by an embodiment of the present invention;
[0024] Figure 6 This is a schematic diagram of the structure of a baud rate setting device provided in an embodiment of the present invention;
[0025] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] Figure 1 This is a flowchart of a baud rate setting method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to scenarios where the baud rate of a urea injection control unit is set. The method can be executed by a baud rate setting device, which can be implemented by software and / or hardware.
[0028] like Figure 1 As shown, the baud rate setting method includes the following steps:
[0029] S110. Identify the preset baud rate valid flag information in the preset memory of the target control unit, and obtain the baud rate valid flag information identification result.
[0030] The target control unit can be the urea injection control unit (DCU) in the vehicle, which is used to control vehicle exhaust emissions. The preset memory can be the RAM (Random Access Memory) of the urea injection control unit, which can store interactive information related to setting the baud rate.
[0031] The preset baud rate validity flag is a pre-defined information used to determine whether the baud rate value in the preset memory is valid. By identifying the preset baud rate validity flag, it can be determined whether the ECU's baud rate needs to be re-identified, and thus the DCU's baud rate can be set. For example, during the DCU production stage or vehicle installation stage, when the power is off, the ECU and DCU are already communicating normally. At this time, the baud rate value in the preset memory is the baud rate at which they can communicate normally, meaning the baud rate value in the preset memory is valid. In this case, the preset baud rate validity flag can be set to 1 to indicate that the baud rate value in the preset memory is valid. When an application in the DCU needs to be updated, it can be updated directly using the baud rate value in the preset memory. However, when switching from the DCU production stage to the vehicle installation stage, or after power-off during the vehicle installation stage, the manufacturer performing the vehicle installation may modify the ECU's baud rate. At this time, the baud rate value in the preset memory may no longer be the actual baud rate of the ECU. Therefore, the preset baud rate validity flag can be set to 0 to indicate that the baud rate value in the preset memory is invalid.
[0032] Furthermore, the bootloader of the target control unit can initialize the bootloader baud rate according to the pre-stored baud rate; and set the preset baud rate valid flag information according to the initialization result of the bootloader baud rate.
[0033] The pre-stored baud rate refers to the baud rate value that has been pre-stored in the preset memory. The bootloader is a program that guides application updates, providing a better system environment for application updates in the DCU. During application updates, to ensure normal communication, the bootloader's baud rate also needs to be consistent with the DCU's. Therefore, the target control unit's bootloader can initialize its own baud rate based on the pre-stored baud rate; that is, it uses the pre-stored baud rate as the bootloader's baud rate. Furthermore, a preset baud rate validity flag can be set based on the bootloader baud rate initialization result. For example, when the bootloader baud rate initialization is successful, the preset baud rate validity flag can be set to 1, indicating that the bootloader baud rate is consistent with the DCU's baud rate, and subsequent application update processes can proceed; when the bootloader baud rate initialization fails, the preset baud rate validity flag is set to 0, indicating that the bootloader baud rate is not consistent with the DCU's baud rate, and subsequent application update processes cannot proceed.
[0034] S120. Based on the baud rate valid flag information identification result, determine the target baud rate setting strategy of the target control unit that matches the associated data transmission object.
[0035] The associated data transfer object can be an application within the DCU. Specifically, Figure 4 This is a flowchart illustrating a DCU installation process provided by an embodiment of the present invention, as follows: Figure 4 As shown, the DCU installation workflow includes: circuit board function testing software flashing, circuit board function testing, vehicle matching software flashing, vehicle matching operation, and vehicle software update. The circuit board function testing software flashing, circuit board function testing, and vehicle matching software flashing can be steps in the production stage, while vehicle matching operation and vehicle software update can be steps in the vehicle installation stage. The steps involving baud rate-based communication are: circuit board function testing software flashing, vehicle matching software flashing, and vehicle software update. Therefore, the applications involving baud rate settings include: circuit board function testing software (APP1), vehicle matching software (APP2), and vehicle update software (APP3). For example, the technical solution of this embodiment can be used to set the baud rate of APP3 when APP3 updates APP2.
[0036] Furthermore, the target baud rate setting strategy can be a strategy about how to set the baud rate of the associated data transmission object. Specifically, the target baud rate setting strategy needs to be determined based on the baud rate valid flag information identification result. For example, when the baud rate valid flag information identification result is that the preset baud rate valid flag information is 1 or 0, the corresponding baud rate setting strategy is matched.
[0037] S130. Set the target baud rate of the target control unit according to the target baud rate setting strategy.
[0038] The target application can be any application that requires baud rate settings. For example, when APP2 is updated by APP3, APP3 can be used as the target application. Correspondingly, the target baud rate can be the baud rate of the target application, i.e., the baud rate value that needs to be determined through baud rate settings. The target baud rate of the target application can be set according to a target baud rate setting strategy. For example, when the baud rate validity flag identification result is 1, it indicates that the pre-stored baud rate value in the preset memory is valid, and it is not necessary to re-identify the ECU's baud rate to set the target baud rate. The target baud rate setting strategy can be to directly use the baud rate value in the preset memory as the target baud rate of the target application. When the baud rate validity flag identification result is 0, it indicates that the pre-stored baud rate value in the preset memory is invalid, and it is necessary to re-identify the ECU's baud rate to set the target baud rate. The target baud rate setting strategy can be based on whether the target control unit can receive the ECU's message data at a preset baud rate reference value.
[0039] The technical solution provided by this invention identifies preset baud rate validity flag information in the preset memory of the target control unit to obtain a baud rate validity flag information identification result; based on the baud rate validity flag information identification result, it determines a target baud rate setting strategy for the target control unit that matches the associated data transmission object; and it sets the target baud rate of the target control unit according to the target baud rate setting strategy. This invention solves the problem that existing technologies offer only one method for setting baud rates, making them unsuitable for different scenarios. It enriches the baud rate setting methods, allowing for the matching of appropriate baud rate setting methods to different scenarios, thus improving adaptability to various situations.
[0040] Figure 3 This is a flowchart of a baud rate setting method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to scenarios where the baud rate of a urea injection control unit is set. Based on the above embodiments, this embodiment further explains how to set the target baud rate of the target control unit according to the target baud rate setting strategy. The device can be implemented by software and / or hardware and integrated into a computer device with application development capabilities.
[0041] like Figure 3 As shown, the baud rate setting method includes the following steps:
[0042] S210. Identify the preset baud rate valid flag information in the preset memory of the target control unit, and obtain the baud rate valid flag information identification result.
[0043] The target control unit can be the urea injection control unit in the vehicle, which is used to control vehicle exhaust emissions. The preset memory can be the RAM of the urea injection control unit, which can store interactive information related to setting the baud rate.
[0044] The preset baud rate validity flag is a pre-defined information used to determine whether the baud rate value in the preset memory is valid. By identifying the preset baud rate validity flag, it can be determined whether the ECU's baud rate needs to be re-identified, and thus the DCU's baud rate can be set. For example, during the DCU production stage or vehicle installation stage, when the power is off, the ECU and DCU are already communicating normally. At this time, the baud rate value in the preset memory is the baud rate at which they can communicate normally, meaning the baud rate value in the preset memory is valid. In this case, the preset baud rate validity flag can be set to 1 to indicate that the baud rate value in the preset memory is valid. When an application in the DCU needs to be updated, it can be updated directly using the baud rate value in the preset memory. However, when switching from the DCU production stage to the vehicle installation stage, or after power-off during the vehicle installation stage, the manufacturer performing the vehicle installation may modify the ECU's baud rate. At this time, the baud rate value in the preset memory may no longer be the actual baud rate of the ECU. Therefore, the preset baud rate validity flag can be set to 0 to indicate that the baud rate value in the preset memory is invalid.
[0045] Furthermore, the bootloader of the target control unit can initialize the bootloader baud rate according to the pre-stored baud rate; and set the preset baud rate valid flag information according to the initialization result of the bootloader baud rate.
[0046] The pre-stored baud rate refers to the baud rate value that has been pre-stored in the preset memory. The bootloader is a program that guides application updates, providing a better system environment for application updates in the DCU. During application updates, to ensure normal communication, the bootloader's baud rate also needs to be consistent with the DCU's. Therefore, the target control unit's bootloader can initialize its own baud rate based on the pre-stored baud rate; that is, it uses the pre-stored baud rate as the bootloader's baud rate. Furthermore, a preset baud rate validity flag can be set based on the bootloader baud rate initialization result. For example, when the bootloader baud rate initialization is successful, the preset baud rate validity flag can be set to 1, indicating that the bootloader baud rate is consistent with the DCU's baud rate, and subsequent application update processes can proceed; when the bootloader baud rate initialization fails, the preset baud rate validity flag is set to 0, indicating that the bootloader baud rate is not consistent with the DCU's baud rate, and subsequent application update processes cannot proceed.
[0047] Specifically, Figure 4 This is a flowchart illustrating a process for setting baud rate valid flag information according to an embodiment of the present invention, such as... Figure 4 As shown, the workflow for setting the baud rate valid flag information is as follows: First, the Bootloader is entered. The Bootloader then identifies the pre-stored baud rate written to RAM by the APP, initializes the Bootloader baud rate based on the pre-stored baud rate, sets the baud rate valid flag information in RAM according to the initialization result of the Bootloader baud rate, and finally jumps to the APP.
[0048] S220. Based on the identification result of the baud rate valid flag information, determine the target baud rate setting strategy of the target control unit that matches the associated data transmission object.
[0049] The associated data transmission object can be an application within the DCU. The process from circuit board manufacturing to vehicle use includes: circuit board function testing software flashing, circuit board function testing, vehicle matching software flashing, vehicle integration operation, and vehicle software update. Circuit board function testing software flashing, circuit board function testing, and vehicle matching software flashing can be steps during the production stage, while vehicle integration operation and vehicle software update can be steps during the vehicle installation stage. The steps involving baud rate-based communication are: circuit board function testing software flashing, vehicle matching software flashing, and vehicle software update. Therefore, the applications involving baud rate settings include: circuit board function testing software (APP1), vehicle matching software (APP2), and vehicle update software (APP3). For example, the technical solution of this embodiment can be used to set the baud rate of APP3 when APP3 updates APP2.
[0050] Furthermore, the target baud rate setting strategy can be a strategy about how to set the baud rate of the associated data transmission object. Specifically, the target baud rate setting strategy needs to be determined based on the baud rate valid flag information identification result. For example, when the baud rate valid flag information identification result is that the preset baud rate valid flag information is 1 or 0, the corresponding baud rate setting strategy is matched.
[0051] S230. When the target baud rate setting strategy is the first baud rate setting strategy, the target baud rate of the target application is set based on the message data reception result of the target control unit under the preset baud rate reference value.
[0052] The first baud rate setting strategy can be a strategy where the preset baud rate validity flag is 0. When the preset baud rate validity flag is 0, it indicates that the pre-stored baud rate value in the preset memory is invalid, and the ECU's baud rate needs to be re-identified to set the DCU's baud rate. The preset baud rate reference value can be a preset reference value that can be used to determine the ECU's baud rate. Specifically, a communication connection between the target control unit and the preset electronic control unit (ECU) can be established based on the CAN bus communication protocol and the preset baud rate reference value. The message data sent by the preset ECU can be received based on the communication connection, and whether the message data is received under the preset baud rate reference value is taken as the message data reception result.
[0053] The target application can be any application that requires baud rate settings. For example, when APP2 is updated by APP3, APP3 can be used as the target application. Correspondingly, the target baud rate can be the baud rate of the target application, i.e., the baud rate value that needs to be determined through baud rate settings. The target baud rate of the target application can be set based on the message data reception results of the target control unit at a preset baud rate reference value. For example, if message data is received from the preset electronic control unit when the target control unit's baud rate is set to the preset baud rate reference value, then the preset electronic control unit's baud rate value is the preset baud rate reference value, and the target baud rate can be set to the preset baud rate reference value. Conversely, if no message data is received from the preset electronic control unit when the target control unit's baud rate is set to the preset baud rate reference value, then the preset electronic control unit's baud rate value is not the preset baud rate reference value, and the target baud rate cannot be set to the preset baud rate reference value.
[0054] Existing technologies can determine whether the preset baud rate reference value matches the preset electronic control unit's baud rate using registers in a microcontroller chip, when the target control unit's baud rate is a preset baud rate reference value. However, this requires introducing hardware with register functionality, increasing the cost of baud rate setting. Furthermore, when the preset baud rate reference value is not the preset electronic control unit's baud rate, the register will issue an error message, affecting the vehicle's normal communication. Correspondingly, since the target control unit and the preset electronic control unit exchange a large amount of message data during normal communication, the technical solution provided in this invention sets the target baud rate of the target application by using the message data reception results of the target control unit at the preset baud rate reference value. This reduces the cost of baud rate setting and improves the accuracy of identifying the preset electronic control unit's baud rate.
[0055] In one optional implementation, the target baud rate of the target control unit can be set to a preset baud rate reference value in a preset baud rate reference value list. The target baud rate is then determined based on the message data received by the target control unit from the preset electronic control unit, according to the message data reception result of the target control unit. When no message data is received within a preset message reception time threshold, the target control unit baud rate is sequentially set to each preset baud rate reference value in the preset baud rate reference value list, based on the order of the preset baud rate reference values. The target baud rate is then determined based on the message data reception result of the target control unit at each preset baud rate reference value. When message data is received within the preset message reception time threshold, the preset baud rate reference value is used as the target baud rate.
[0056] The preset baud rate reference value list can contain multiple preset baud rate reference values. For example, it can include three values: 250K, 500K, and 1MHz. When the target control unit baud rate is 250K, if no message data is received within the preset message reception time threshold, it means that the preset electronic control unit baud rate is not 250K. In this case, the target control unit baud rate can be set to 500K, and then it can be determined whether message data is received within the preset message reception time threshold. This process continues until all preset baud rate reference values in the preset baud rate reference value list are traversed. When the target control unit baud rate is a certain preset baud rate reference value and message data is received within the preset message reception time threshold, that preset baud rate reference value can be used as the target baud rate.
[0057] S240. When the target baud rate setting strategy is the second baud rate setting strategy, the target baud rate of the target application is set based on the pre-stored baud rate in the preset memory.
[0058] The second baud rate setting strategy can be a baud rate setting strategy when the preset baud rate valid flag information is 1. When the preset baud rate valid flag information is 1, it means that the pre-stored baud rate value in the preset memory is valid. There is no need to re-identify the baud rate of the ECU and then set the baud rate of the DCU. The pre-stored baud rate in the preset memory can be directly set as the target baud rate of the target application.
[0059] In an optional implementation, the preset baud rate valid flag information can also be set by the DCU's APP. For example, when the DCU is powered on again after a power outage, the preset baud rate valid flag information is 0. After executing the first baud rate setting strategy described above to obtain the target baud rate, the APP can use the target baud rate as the pre-stored baud rate in RAM and set the preset baud rate valid flag information in RAM to 1.
[0060] For example, Figure 5 This is a flowchart illustrating a baud rate setting process provided by an embodiment of the present invention, as follows: Figure 5As shown, the baud rate setting workflow is as follows: First, it checks if the baud rate in RAM is valid. If the baud rate in RAM is valid, it is used as the target baud rate. If the baud rate in RAM is invalid, the DCU's baud rate is set to A, and message data from the ECU is received. Then, it checks if message data is received within a preset time. If message data is received within the preset time, A is written to RAM as the target baud rate, and the validity flag is set to 1. If no message data is received within the preset time, the DCU's baud rate is set to B, and message data from the ECU is received. Then, it checks the preset time... The system checks whether message data is received within a preset time. If message data is received within the preset time, B is written to RAM as the target baud rate, and the validity flag is set to 1. If no message data is received within the preset time, the DCU's baud rate is set to C, and message data from the ECU is received. The system then checks whether message data is received within the preset time. If message data is received within the preset time, C is written to RAM as the target baud rate, and the validity flag is set to 1. If no message data is received within the preset time, the DCU's baud rate is set to another value, and the target baud rate is set based on whether message data from the ECU is received.
[0061] Specifically, since APP1 in the DCU is still in the production stage after being flashed, when the DCU is powered off and then powered on again, APP1 will not determine the baud rate of the production stage using the first baud rate setting strategy mentioned above. APP1 can obtain the baud rate of the production stage by communicating with the manufacturer's preset host computer. The technical solution provided by this embodiment of the invention obtains the baud rate valid flag information identification result by identifying the preset baud rate valid flag information in the preset memory of the target control unit; based on the baud rate valid flag information identification result, the target baud rate setting strategy of the target control unit matching the associated data transmission object is determined; on the one hand, when the target baud rate setting strategy is the first baud rate setting strategy, the target baud rate of the target application is set based on the message data reception result of the target control unit under the preset baud rate reference value; on the other hand, when the target baud rate setting strategy is the second baud rate setting strategy, the target baud rate of the target application is set based on the pre-stored baud rate in the preset memory. The technical solution of this embodiment of the invention solves the problem that the existing technology has a single baud rate setting method, which cannot be applied to different scenarios. It can enrich the baud rate setting methods, match the appropriate baud rate setting method according to different scenarios, and improve the adaptability to different scenarios.
[0062] Figure 5This is a schematic diagram of a baud rate setting device provided in an embodiment of the present invention. The embodiment of the present invention can be applied to scenarios where the baud rate of a urea injection control unit is set. The device can be implemented by software and / or hardware and integrated into a computer device with application development capabilities.
[0063] like Figure 5 As shown, the baud rate setting device includes: a baud rate valid flag information identification module 310, a baud rate setting strategy determination module 320, and a baud rate setting module 330.
[0064] Among them, the baud rate valid flag information identification module 310 is used to identify the preset baud rate valid flag information in the preset memory of the target control unit and obtain the baud rate valid flag information identification result;
[0065] The baud rate setting strategy determination module 320 is used to determine the target baud rate setting strategy of the target control unit that matches the associated data transmission object based on the baud rate valid flag information identification result;
[0066] The baud rate setting module 330 is used to set the target baud rate of the target control unit according to the target baud rate setting strategy.
[0067] The technical solution provided by this invention identifies preset baud rate validity flag information in the preset memory of the target control unit to obtain a baud rate validity flag information identification result; based on the baud rate validity flag information identification result, it determines a target baud rate setting strategy for the target control unit that matches the associated data transmission object; and it sets the target baud rate of the target control unit according to the target baud rate setting strategy. This invention solves the problem that existing technologies offer only one method for setting baud rates, making them unsuitable for different scenarios. It enriches the baud rate setting methods, allowing for the matching of appropriate baud rate setting methods to different scenarios, thus improving adaptability to various situations.
[0068] In one optional implementation, the baud rate setting module 330 is specifically used to: when the target baud rate setting strategy is the first baud rate setting strategy, set the target baud rate of the target application based on the message data reception result of the target control unit under the preset baud rate reference value;
[0069] When the target baud rate setting strategy is the second baud rate setting strategy, the target baud rate of the target application is set based on the pre-stored baud rate in the preset memory.
[0070] In an optional implementation, the baud rate setting module 330 can also be used to: set the target control unit baud rate of the target control unit to a preset baud rate reference value in the preset baud rate reference value list, and receive message data sent by the preset electronic control unit based on the preset baud rate reference value; and set the target baud rate according to the message data reception result of the target control unit on the message data.
[0071] In an optional implementation, the baud rate setting module 330 can also be used to: when message data is received within a preset message reception time threshold, use a preset baud rate reference value as the target baud rate.
[0072] In an optional implementation, the baud rate setting module 330 can also be used to: when no message data is received within a preset message reception time threshold, set the target control unit baud rate sequentially to each preset baud rate reference value in the preset baud rate reference value list based on the arrangement order of the preset baud rate reference values in the preset baud rate reference value list; and set the target baud rate according to the message data reception results of the target control unit at each preset baud rate reference value.
[0073] In one optional embodiment, the baud rate setting device further includes: a preset baud rate valid flag information setting module, used for: initializing the bootloader baud rate of the target control unit's bootloader according to a pre-stored baud rate; and setting the preset baud rate valid flag information according to the initialization result of the bootloader baud rate.
[0074] In one optional implementation, the baud rate setting device further includes a unit communication module, used to: establish a communication connection between the target control unit and the preset electronic control unit based on the CAN bus communication protocol and a preset baud rate reference value, and to receive message data sent by the preset electronic control unit based on the communication connection.
[0075] The baud rate setting device provided in the embodiments of the present invention can execute the baud rate setting method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0076] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 7 A block diagram of an exemplary computer device 12 suitable for implementing embodiments of the present invention is shown. Figure 7 The computer device 12 shown is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the present invention. The computer device 12 can be any terminal device with computing capabilities and can be integrated into a baud rate setting device.
[0077] like Figure 7 As shown, the computer device 12 is represented in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and a bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0078] Bus 18 can be one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0079] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0080] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 7 Not shown; usually referred to as a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0081] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0082] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with the computer device 12, and / or with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although... Figure 7 As not shown, it can be used in conjunction with computer device 12 with other hardware and / or software modules, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0083] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing the baud rate setting method provided in this embodiment, which includes:
[0084] Identify the preset baud rate valid flag information in the preset memory of the target control unit to obtain the baud rate valid flag information identification result;
[0085] Based on the baud rate valid flag information identification result, the target baud rate setting strategy of the target control unit matching the associated data transmission object is determined;
[0086] The target baud rate of the target control unit is set according to the target baud rate setting strategy.
[0087] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the baud rate setting method as provided in any embodiment of the present invention, including:
[0088] Identify the preset baud rate valid flag information in the preset memory of the target control unit to obtain the baud rate valid flag information identification result;
[0089] Based on the baud rate valid flag information identification result, the target baud rate setting strategy of the target control unit matching the associated data transmission object is determined;
[0090] The target baud rate of the target control unit is set according to the target baud rate setting strategy.
[0091] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0092] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0093] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0094] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0095] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0096] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A baud rate setting method characterized by comprising: The method comprises the following steps: identifying preset baud rate effective flag information in a preset memory of a target control unit to obtain baud rate effective flag information identification result; determining a target baud rate setting strategy of the target control unit matched with a data transmission object based on the baud rate effective flag information identification result; setting a target baud rate of the target control unit according to the target baud rate setting strategy; when the target baud rate setting strategy is a first baud rate setting strategy, setting a target baud rate of a target application based on a packet data receiving result of the target control unit at a preset baud rate reference value; when the target baud rate setting strategy is a second baud rate setting strategy, setting the target baud rate of the target application based on a preset baud rate in the preset memory.
2. The method of claim 1, wherein, The step of setting the target baud rate of the target application based on the packet data receiving result of the target control unit at the preset baud rate reference value comprises the following steps: setting a target control unit baud rate of the target control unit to the preset baud rate reference value in a preset baud rate reference value list, and receiving packet data sent by a preset electronic control unit based on the preset baud rate reference value; setting the target baud rate according to a packet data receiving result of the target control unit on the packet data.
3. The method of claim 2, wherein, The step of setting the target baud rate according to the packet data receiving result of the target control unit on the packet data comprises the following steps: when the packet data is received within a preset packet receiving time threshold, setting the preset baud rate reference value as the target baud rate.
4. The method of claim 2, wherein, The step of setting the target baud rate according to the packet data receiving result of the target control unit on the packet data further comprises the following steps: when the packet data is not received within a preset packet receiving time threshold, setting the target control unit baud rate to each preset baud rate reference value in the preset baud rate reference value list in turn based on an arrangement order of the preset baud rate reference value in the preset baud rate reference value list; setting the target baud rate according to a packet data receiving result of the target control unit on the packet data at each preset baud rate reference value.
5. The method of claim 1, wherein, The setting process of the preset baud rate effective flag information comprises the following steps: a bootloader of a target control unit initializes a bootloader baud rate of the bootloader according to the preset baud rate; setting the preset baud rate effective flag information according to an initialization result of the bootloader baud rate.
6. The method of claim 2, wherein, The step of receiving packet data sent by a preset electronic control unit based on the preset baud rate reference value comprises the following steps: establishing a communication connection relationship between the target control unit and the preset electronic control unit based on a CAN bus communication protocol and the preset baud rate reference value, and receiving the packet data sent by the preset electronic control unit based on the communication connection relationship.
7. A baud rate setting apparatus characterized by comprising: The method comprises the following steps: a baud rate effective flag information identification module is configured to identify preset baud rate effective flag information in a preset memory of a target control unit to obtain baud rate effective flag information identification result; a baud rate setting strategy determination module is configured to determine a target baud rate setting strategy of the target control unit matched with a data transmission object based on the baud rate effective flag information identification result; A baud rate setting policy determination module is configured to determine a target baud rate setting policy of the target control unit matched with the associated data transmission object based on the baud rate effective flag information recognition result; A baud rate setting module is configured to set a target baud rate of a target application program based on a packet data receiving result of the target control unit at a preset baud rate reference value when the target baud rate setting policy is a first baud rate setting policy; When the target baud rate setting policy is a second baud rate setting policy, set the target baud rate of the target application program based on a pre-stored baud rate in the preset memory.
8. A computer device, comprising: The computer device comprises: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the baud rate setting method as claimed in any one of claims 1-6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the baud rate setting method as claimed in any one of claims 1-6.
Citation Information
Patent Citations
Method and system for automatically identifying CAN communication baud rate of vehicle ECU
CN111224837A
Baud rate adjusting equipment, method and device
CN115296778A