State switching method and device, vehicle and storage medium
By setting a latch flag in the vehicle and using a timeout timer to manage the transmission process of configuration messages, the problem of disconnect between the vehicle controller and the radio frequency receiver mode configuration was solved, thereby improving the stability of data acquisition and the user experience.
Patent Information
- Application Number
- CN202511742065.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-27
AI Technical Summary
In vehicles, the operating mode configuration of the vehicle controller and the radio frequency receiver is out of sync with the actual mode, resulting in abnormal data acquisition and affecting the user's driving experience.
By setting a latch flag during the configuration request, the transmission process of the configuration message is ensured to be uninterrupted by interruption events, and the main state machine state is switched in a timely manner after transmission is completed. Combined with timeout timer and buffer register management, the complete transmission and state switching of the configuration message are ensured.
It improves the consistency between the operating mode and configuration mode of the RF receiver, ensures the stability of data acquisition and user experience, and avoids configuration message blocking and state machine lag issues.
Smart Images

Figure CN121572903A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of control, and more particularly, to a state switching method and device, a vehicle, and a storage medium in the technical field of control. BACKGROUND
[0002] In related technologies, a vehicle includes a vehicle controller, a radio frequency receiver, and a sensor. The vehicle controller and the radio frequency receiver communicate through a communication bus (such as a K bus), and the radio frequency receiver and the sensor communicate through wireless radio frequency. The radio frequency receiver has multiple working modes, and the vehicle controller can send a target configuration message to the radio frequency receiver through the communication bus to control the radio frequency receiver to adjust the actual working mode to the target working mode.
[0003] However, in some abnormal situations, the vehicle controller may configure the radio frequency receiver to a first working mode (such as a normal receiving mode), while the radio frequency receiver is actually in a second working mode (such as a polling mode).
[0004] The above abnormal situation forms a core contradiction of "configuration and actual" disconnection. In this abnormal situation, the vehicle controller obtains the collected data of the sensor according to the control logic of the normal receiving mode, but the radio frequency receiver is actually in the polling mode and cannot normally collect data, that is, cannot upload the collected data to the vehicle controller. When the vehicle controller continuously detects that the collected data is lost, the vehicle controller will start a protection mechanism to output that the collected data of the sensor is abnormal. This will affect the vehicle user's driving experience. SUMMARY
[0005] The present application provides a state switching method, device, vehicle, and storage medium. The method can prevent the configuration message from being disturbed by an interruption event in the sending process, avoid the case that the main state machine cannot switch from the sending state to the ready state due to the interference of any interruption event, and thus ensure that the radio frequency receiver successfully completes the mode switching.
[0006] In a first aspect, a state switching method is provided. The method is performed by a vehicle controller in a vehicle. The vehicle also includes a radio frequency receiver. The vehicle controller and the radio frequency receiver communicate through a communication bus. The method includes: in a case where a configuration request is detected, setting a latch flag of the radio frequency receiver to a preset value. The configuration request is used to request to configure an actual working mode of the radio frequency receiver to a target working mode. The preset value is used to indicate that a sending process of a configuration message corresponding to the configuration request is not interrupted by an interruption event. The method also includes: controlling a state of a main state machine of the communication bus to be adjusted to a sending state, and sending the configuration message to the radio frequency receiver through the communication bus. The method also includes: in a case where a sending completion flag of the configuration message exists, controlling the main state machine to switch from the sending state to a ready state, and clearing the latch flag.
[0007] In the above technical solution, upon detecting a configuration request, the latch flag of the RF receiver is set to a preset value. This ensures that the configuration message transmission process is unaffected by interruptions, protecting critical transmission processes (critical sections). The main state machine of the control communication bus is switched to the transmission state and the configuration message is sent, ensuring the orderly initiation of the transmission action. When a transmission completion flag is present, the main state machine switches from the transmission state to the ready state and clears the latch flag, ensuring timely state switching after transmission. This setup process, through the latch flag, guarantees that the configuration message transmission process is not interrupted, preventing any interruption events that could prevent the main state machine from switching from the transmission state to the ready state. This increases the probability of successfully sending the configuration message to the RF receiver, allowing the RF receiver to smoothly switch to the target operating mode. The RF receiver can then operate normally in the target operating mode, ensuring that the configured operating mode matches the actual operating mode, thus improving the user experience. Simultaneously, when the transmission completion flag of the configuration message is present, the main state machine switches state and clears the latch flag. This frees up the communication bus, allowing the next configuration message to be sent. Sending each configuration message according to the above scheme also ensures that configuration messages do not clog the vehicle controller.
[0008] In conjunction with the first aspect, in some possible implementations, after the master state machine controlling the communication bus is adjusted to the transmit state, the method further includes: starting a timeout timer, the duration of which is the sum of the total transmission duration of the configuration message and the response time of the transmission completion flag; and after the configuration message is transmitted to the radio frequency receiver via the communication bus, the method further includes: determining whether the timeout timer has overflowed if the transmission completion flag is not present; detecting whether the configuration message has been completely transmitted if the timeout timer has overflowed; and controlling the master state machine to switch from the transmit state to the ready state and clearing the latch flag if the configuration message has been completely transmitted.
[0009] In the above technical solution, while ensuring that the configuration message is not interrupted during the transmission process by using a latch flag, a timeout timer is started before setting the latch flag to a preset value. This allows for setting a reasonable and sufficient time boundary for the transmission process. After sending the configuration message, if the transmission completion flag is not detected, it is determined whether the timeout timer has overflowed. After the timeout timer overflows and it is confirmed that the configuration message has been completely sent, the main state machine is controlled to switch from the sending state to the ready state. This mechanism effectively avoids the problem that the main state machine might be stuck in the sending state for a long time due to an abnormal absence of the transmission completion flag, preventing it from switching to the ready state and thus hindering the transmission of other configuration messages. It also supplements the state transition guarantee when the transmission completion flag is abnormal.
[0010] In combination with the first aspect and the above implementation, in some possible implementations, before clearing the latch flag, the method further includes: detecting whether an interrupt event is received; if an interrupt event is received, detecting whether the latch flag has been cleared; if the latch flag has not been cleared, returning the interrupt event along the original path.
[0011] In the above technical solution, while ensuring that the configuration message is not interrupted by interruption events during the transmission process through the latch flag, an interruption event is detected before clearing the latch flag. If an interruption event is received, it is checked whether the latch flag has been cleared. If the latch flag has not been cleared, the interruption event is returned along the original path. This design strengthens the protection of the critical section, ensuring that no interruption event will interfere while the latch flag is still valid (i.e., the configuration process is not yet complete). This avoids state machine chaos or interruption of the configuration process caused by an interruption event being accidentally triggered before the latch flag is cleared, further ensuring the atomicity and stability of the main state machine's state transitions.
[0012] In combination with the first aspect and the above implementation methods, in some possible implementation methods, setting the latch flag of the radio frequency receiver to a preset value includes: setting the latch flag to the preset value in the memory of the vehicle controller; and controlling the main state machine to switch from the transmitting state to the ready state and clearing the latch flag includes: controlling the main state machine to switch from the transmitting state to the ready state and clearing the latch flag in the memory.
[0013] In the above technical solution, while ensuring that the configuration message transmission process is not interrupted by events through the latch flag, the setting operation of the latch flag is explicitly performed in the memory of the vehicle controller, and the subsequent clearing of the latch flag is also performed in memory. This design can solve the problem in related technologies where the flag exists in both memory and registers, leading to inconsistencies in the flag state between the register and memory when updating the flag and there is a transmission delay. This solution controls the latch flag only in memory, ensuring that the setting and clearing of the latch flag are always based on a unified memory storage location, thus avoiding the problem of inconsistent flag states from the source. At the same time, it also makes the control logic and the state transition process of the main state machine, which are designed to prevent interference from interrupt events, more stable.
[0014] In combination with the first aspect and the above implementation, in some possible implementations, sending the configuration message to the radio frequency receiver via the communication bus includes: loading the configuration message into the buffer register of the vehicle controller via the communication bus, reading each data bit from the buffer register, and sending it to the radio frequency receiver; and after sending the configuration message to the radio frequency receiver via the communication bus, the method further includes: determining whether the configuration message exists in the buffer register; and if the configuration message does not exist in the buffer register, determining whether the transmission completion flag bit exists.
[0015] In the above technical solution, during the process of sending configuration messages to the RF receiver, the configuration message is first loaded into a buffer register, and then the data bits are read for transmission. This aligns with the hardware characteristics of the communication bus, using the buffer register to resolve the difference between the message processing rate of the vehicle controller and the message transmission rate of the communication bus. With the latch flag ensuring the transmission process is not interrupted by events, it ensures the continuous and stable transmission of multi-byte configuration messages. After the configuration message is sent, it is first confirmed that there is no configuration message in the buffer register, and then the transmission completion flag is checked. This refines the logic for determining transmission completion. This avoids the situation where residual data bits in the buffer register result in a transmission completion flag. The above solution improves the accuracy of state transition judgments in the master state machine, making the basis for state transitions more reliable.
[0016] In conjunction with the first aspect and the above implementation methods, in some possible implementation methods, before loading the configuration message into the buffer register of the vehicle controller via the communication bus, the method further includes: detecting whether the buffer register is in a preset state, the preset state being used to indicate that the buffer register is in a fully loaded state for a preset duration and no data bits are read from the buffer register; if the buffer register is in the preset state, initializing the communication bus system and outputting a reminder message, the reminder message being used to remind that the buffer register has failed but has been initialized, and retransmitting the configuration message to the radio frequency receiver.
[0017] In the above technical solution, based on the latch flag used to prevent interference from interrupt events and the buffer register used to ensure the continuity of configuration message transmission, the buffer register is checked to see if it is in a preset state before loading the configuration message. This can proactively detect abnormalities in the buffer register and avoid configuration message transmission delays due to buffer register failure. Furthermore, when the buffer register malfunctions, the communication bus system is initialized and an alert message is output. This can quickly restore the communication environment. In addition, reminding the user to resend the configuration message to the RF receiver can compensate for buffer failure scenarios not covered in previous solutions, further improving the abnormal handling mechanism of the configuration process.
[0018] In combination with the first aspect and the above implementation methods, in some possible implementation methods, before setting the latch flag of the radio frequency receiver to a preset value when a configuration request is detected, the method further includes: detecting whether the vehicle is in sentry mode; and if the vehicle is in sentry mode, controlling the working network segment of the radio frequency receiver to access the target network segment, which is a low-power monitoring network segment.
[0019] In the above technical solution, after ensuring that the configuration message is not interrupted during the transmission process by using a latch flag, the system checks whether the vehicle is in sentry mode before setting the latch flag to a preset value. Sentry mode is the mode in which the vehicle is under security monitoring. In sentry mode, the vehicle is off but maintains awareness of its surroundings. In this low-power state, the solution controls the RF receiver to access a low-power target network segment. This avoids increasing the power consumption of the RF receiver when using other network segments in sentry mode. Simultaneously, this target network segment is optimized for monitoring scenarios, ensuring stable transmission of critical monitoring signals in sentry mode. Furthermore, it allows configuration requests to be executed in a network environment adapted to sentry mode.
[0020] Secondly, a state switching device is provided, executed by a vehicle controller in a vehicle, which also includes a radio frequency receiver. The vehicle controller communicates with the radio frequency receiver via a communication bus. The device includes: a setting module, configured to set a latch flag of the radio frequency receiver to a preset value upon detecting a configuration request, wherein the configuration request requests the actual operating mode of the radio frequency receiver to be configured as a target operating mode, and the preset value indicates that the transmission process of the configuration message corresponding to the configuration request will not be interrupted by an interruption event; a sending module, configured to control the main state machine of the communication bus to adjust its state to a sending state and send the configuration message to the radio frequency receiver via the communication bus; and a clearing module, configured to control the main state machine to switch from the sending state to a ready state and clear the latch flag when a transmission completion flag of the configuration message is present.
[0021] In conjunction with the second aspect, in some possible implementations, after the master state machine controlling the communication bus is adjusted to the transmit state, the device further includes: a startup module for starting a timeout timer, the duration of which is the sum of the total transmission duration of the configuration message and the response time of the transmission completion flag; and, after the configuration message is transmitted to the radio frequency receiver via the communication bus, the device further includes: a determination module for determining whether the timeout timer has overflowed if the transmission completion flag is not present; a detection module for detecting whether the configuration message has been completely transmitted if the timeout timer has overflowed; and a clearing module specifically for controlling the master state machine to switch from the transmit state to the ready state and clearing the latch flag if the configuration message has been completely transmitted.
[0022] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, before clearing the latch flag, the detection module is further configured to: detect whether an interrupt event is received; if an interrupt event is received, detect whether the latch flag is cleared; the sending module is further configured to return the interrupt event along the original path if the latch flag is not cleared.
[0023] In combination with the second aspect and the above implementation, in some possible implementations, the setting module is specifically used to set the latch flag to the preset value in the memory of the vehicle controller; and the clearing module is specifically used to control the main state machine to switch from the sending state to the ready state and clear the latch flag in the memory.
[0024] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the sending module is specifically used to load the configuration message into the buffer register of the vehicle controller via the communication bus, and to read each data bit from the buffer register and send it to the radio frequency receiver; and after sending the configuration message to the radio frequency receiver via the communication bus, the determining module is further used to: determine whether there is a configuration message in the buffer register; and if there is no configuration message in the buffer register, determine whether there is a sending completion flag bit.
[0025] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, before loading the configuration message into the buffer register of the vehicle controller via the communication bus, the detection module is further configured to detect whether the buffer register is in a preset state. The preset state is used to indicate that the buffer register is in a fully loaded state for a preset period of time and no data bits are read from the buffer register. The device also includes an output module, configured to initialize the communication bus system and output a reminder message when the buffer register is in the preset state. The reminder message is used to remind that the buffer register has failed but has been initialized, and to resend the configuration message to the radio frequency receiver.
[0026] In conjunction with the second aspect and the above implementation, in some possible implementations, before setting the latch flag of the radio frequency receiver to a preset value upon detecting a configuration request, the detection module is also used to detect whether the vehicle is in sentry mode; the device further includes: an access module, used to control the working network segment of the radio frequency receiver to access the target network segment when the vehicle is in the sentry mode, the target network segment being a low-power monitoring network segment.
[0027] Thirdly, a vehicle is provided, including a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, causing the vehicle to perform the methods described in the first aspect or any possible implementation thereof.
[0028] Fourthly, a computer-readable storage medium is provided that stores executable program code, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof. Attached Figure Description
[0029] Figure 1 This is a schematic diagram of a scenario using a radio frequency receiver provided in an embodiment of this application; Figure 2 This is a schematic diagram illustrating a radio frequency receiver with multiple operating modes provided in an embodiment of this application; Figure 3 This is a schematic flowchart illustrating a state switching method provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the initialization of a communication bus system according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a state switching device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application. Detailed Implementation
[0030] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0031] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0032] Figure 1 This is a schematic diagram of a scenario using a radio frequency receiver provided in an embodiment of this application.
[0033] For example, such as Figure 1 As shown, vehicle A contains a vehicle controller, an RF receiver, and sensors. The vehicle controller communicates with the RF receiver via a communication bus (such as a K-bus), and the RF receiver communicates with the sensors wirelessly. The sensors monitor the vehicle's operating status and environmental parameters, obtaining initial sensor data. The RF receiver receives this initial sensor data, verifies it, and sends valid sensor data to the vehicle controller for further processing. One such sensor is a tire pressure sensor.
[0034] The K-bus is a low-speed serial communication bus in vehicles, belonging to the physical carrier of traditional on-board diagnostic communication. Essentially, it is a physical wire primarily used for the wired transmission of control commands or configuration messages (also known as Radio Frequency (RF) pending messages) between the vehicle controller and the RF receiver. RF pending messages refer to formatted data frames transmitted on the K-bus. The K-bus master state machine is the logic controller that manages the communication process of the K-bus, managing the sending and receiving of RF pending messages, as well as the state transitions of the master state machine. It directly determines whether RF pending messages can be transmitted normally, and since RF pending messages control the operating mode of the RF receiver, the normal operation of the master state machine indirectly affects the transmission of RF pending messages.
[0035] Among them, such as Figure 2 As shown, the RF receiver has multiple operating modes, including pass-through mode, polling mode, Passive Keyless Entry (PKE) receiving mode, constant receiving mode, Tire Pressure Monitoring System (TPMS) mode, welcome mode, and transportation mode. The vehicle controller can send a target configuration message to the RF receiver via the communication bus to control the RF receiver to adjust its actual operating mode to the target operating mode. The initial operating mode of the RF receiver is pass-through mode. The RF receiver can switch from pass-through mode to other operating modes, but once configured to another operating mode, it cannot switch back to pass-through mode. It can switch between polling mode, PKE receiving mode, constant receiving mode, TPMS mode, welcome mode, and transportation mode. If the PKE receiving mode times out, it will revert to polling mode.
[0036] The following modes are defined as follows: **Pass-through mode:** The RF receiver directly forwards sensor data to the vehicle controller after receiving it, meaning the RF receiver does not arbitrarily process the sensor data. **Polling mode:** The RF receiver actively monitors the status of each sensor according to a preset period. **PKE receiving mode:** The receiver switches to receiving mode when a legitimate key is detected approaching. **Continuous receiving mode:** The RF receiver is always in receiving mode, capturing sensor data in real time. In this continuous receiving mode, the vehicle power is on, there is no vehicle speed, and the vehicle's power consumption is high; this is typically used in high-end models or special scenarios (such as emergency call scenarios). **TPMS mode:** The RF receiver is dedicated to processing tire pressure sensor data; this is a working mode when the vehicle has speed, and the vehicle power is on. **Welcome mode:** The RF receiver triggers the vehicle's welcome mode when a legitimate key is detected approaching. In both polling and welcome modes, the vehicle power is off. **Transportation mode:** During vehicle transportation, the RF receiver enters a low-power state, only receiving specific signals (such as anti-theft alarms). The "ON" state is the active state, and the "OFF" state is the passive state.
[0037] However, under certain abnormal conditions, the vehicle controller may configure the RF receiver in the first operating mode (such as normal receiving mode), while the RF receiver is actually operating in the second operating mode (such as polling mode). Specifically, the above abnormal condition occurs when the master state machine of the communication bus fails to switch from the transmitting state to the ready state, that is, the state machine fails to release the communication bus. Consequently, it is impossible to retrieve the configuration message from the buffer register of the vehicle controller through the communication bus and send it to the RF receiver. In other words, because the state transition of the master state machine fails, the old configuration message in the buffer register cannot be retrieved and sent, the buffer register resources cannot be released, and eventually the buffer register becomes completely full. The new target configuration message cannot be stored in the buffer register or sent. Therefore, the target configuration message cannot be successfully sent to the RF receiver, which results in the RF receiver's actual operating mode remaining the second operating mode.
[0038] The state transitions of the main state machine are executed through the target code (main task). The main task contains several critical code segments that must be executed atomically, also known as critical sections. In related technologies, during the transmission of configuration messages via the communication bus, the main task is re-monitoring various flag bits within the critical section (e.g., clearing the first variable). If an interrupt event is received at this time, the main task responds to the interrupt event, setting the first variable to 1 based on the flag bits indicated in the interrupt event to indicate that the configuration message has been successfully transmitted. Afterward, the main task returns from the interrupt event and continues executing the critical section. That is, the main task clears the first variable because the atomicity requirement of the critical section necessitates reinitializing the flag bits. This causes the first variable set by the interrupt event to be overwritten, and the main task cannot detect the "configuration message has been successfully transmitted" indication from the first variable, thus failing to initiate the state transition of the main state machine.
[0039] In other words, the transition from the sending state to the ready state in the main state machine is an atomic operation. The aforementioned interruption event disrupts the critical section, breaking this atomicity and causing the main state machine to be unable to complete the state transition, thus getting stuck in the sending state.
[0040] Therefore, the aforementioned anomaly creates a core contradiction: a disconnect between configuration and reality. In this anomaly, the vehicle controller acquires sensor data according to its normal receiving mode control logic. However, the RF receiver is actually in polling mode and cannot acquire data normally, meaning it cannot upload the acquired data to the vehicle controller. When the vehicle controller continuously detects data loss, it activates a protection mechanism, outputting an anomaly report for sensor data acquisition. This negatively impacts the user experience.
[0041] To address the aforementioned issues, this application proposes a state switching method to ensure smooth state switching of the master state machine during the process of the vehicle controller sending configuration messages to the radio frequency receiver. The specific steps are as follows: Figure 3 .
[0042] Figure 3 This is a schematic flowchart illustrating a state switching method provided in an embodiment of this application.
[0043] It should be understood that the state switching method provided in this application embodiment can be applied to, for example... Figure 1 The vehicle controller in the vehicle shown (e.g., vehicle A).
[0044] For example, the method is executed by a vehicle controller in a vehicle, which also includes a radio frequency receiver. The vehicle controller communicates with the radio frequency receiver via a communication bus, such as... Figure 3 As shown, the method 300 includes the following steps 301 to 303.
[0045] Optionally, the communication bus can be any one of a K-bus, a CAN (Controller Area Network) bus, or a LIN (Local Interconnect Network) bus.
[0046] Among them, the CAN bus is a serial communication bus for automotive electronics, featuring high real-time performance and strong anti-interference capabilities, making it the most widely used bus in vehicles. The LIN bus is a low-cost serial communication bus with low hardware requirements, primarily used for low-speed data transmission in non-real-time, low-bandwidth scenarios between the vehicle controller and the RF receiver.
[0047] Step 301: When a configuration request is detected, the latch flag of the radio frequency receiver is set to a preset value. The configuration request is used to request that the actual working mode of the radio frequency receiver be configured to the target working mode. The preset value is used to indicate that the transmission process of the configuration message corresponding to the configuration request will not be interrupted by the interruption event.
[0048] It should be understood that the latch flag bit of the RF receiver in step 301 above refers to the flag bit set by the vehicle controller and applied during the configuration process of the RF receiver's operating mode. When the latch flag bit is set to a preset value, it can be considered that the configuration process (actually the occurrence process) of the configuration message corresponding to the above configuration request is locked and will not be interrupted by any interruption event. Optionally, the preset value is 1.
[0049] It should also be understood that the interruption event in step 301 above is any event that can affect the configuration process.
[0050] Optionally, the interrupt event includes any one of a transmit completion interrupt event, an acknowledgement interrupt event, and an error interrupt event.
[0051] The transmission completion interruption event is an interruption event indicating that the configuration message has been successfully transmitted. If this interruption event is triggered at an inappropriate time, it will affect the configuration process. The inappropriate time is the execution time of the critical section. The acknowledgment interruption event is an interruption event occurring when the RF receiver acknowledges the configuration message. Optionally, the error interruption event includes interruptions triggered by unwanted electrical signal interference in the communication bus.
[0052] Step 302: Adjust the state of the master state machine of the communication bus to the transmit state, and send the configuration message to the radio frequency receiver through the communication bus.
[0053] It should be understood that in step 302 above, adjusting the state of the master state machine to the transmit state is for the purpose of sending configuration messages to the radio frequency receiver in subsequent processes.
[0054] The following is a detailed description of the "process of sending configuration messages".
[0055] In one possible implementation, step 302, sending the configuration message to the radio frequency receiver via the communication bus, includes: loading the configuration message into the buffer register of the vehicle controller via the communication bus, reading each data bit from the buffer register, and sending it to the radio frequency receiver; and after sending the configuration message to the radio frequency receiver via the communication bus in step 302, the method 300 further includes: determining whether a configuration message exists in the buffer register; and if no configuration message exists in the buffer register, determining whether a transmission completion flag exists.
[0056] It should be understood that in the above scheme, when sending configuration messages to the RF receiver via the communication bus, the configuration messages need to be loaded into a buffer register first, and then sent. This is mainly affected by the inconsistency between the message processing rate and the message transmission rate. That is, the vehicle controller receives multiple configuration messages within the same time period. The vehicle controller can process (e.g., verify) these multiple configuration messages quickly. However, the transmission rate of the communication bus is low, and there are many configuration messages to be sent and processed, making it impossible to send these messages quickly. Therefore, a buffer register is set up to load these configuration messages to be sent and processed into the buffer register in the order of transmission, and to send them one by one when the communication bus is idle.
[0057] It should also be understood that the transmission completion flag in the above scheme refers to the flag indicating that the configuration message has been completely transmitted via the communication bus. In the above scheme, the absence of a configuration message in the buffer register verifies the transmission of the configuration message from a software perspective; the presence of the transmission completion flag verifies the transmission of the configuration message from a hardware perspective.
[0058] In the above technical solution, during the process of sending configuration messages to the RF receiver, the configuration message is first loaded into a buffer register, and then the data bits are read for transmission. This aligns with the hardware characteristics of the communication bus, using the buffer register to resolve the difference between the message processing rate of the vehicle controller and the message transmission rate of the communication bus. The aforementioned latch flag ensures that the transmission process is not interrupted by events, guaranteeing the continuous and stable transmission of multi-byte configuration messages. After the configuration message is sent, it is first determined that there is no configuration message in the buffer register, and then the transmission completion flag is checked, refining the logic for determining transmission completion. This avoids the situation where residual data bits exist in the buffer register, thus preventing incomplete configuration message transmission. The above solution improves the accuracy of the state transition judgment of the master state machine, making the basis for the master state machine's state transition more reliable. In other words, the above solution improves the integrity of configuration message transmission and the reliability of state transitions.
[0059] In some embodiments, the method 300 further includes: if a configuration message exists in the buffer register, continuing to read data bits from the buffer register and sending them to the radio frequency receiver until no configuration message exists in the buffer register.
[0060] It should be understood that the above scheme describes the process of loading the configuration message into the buffer register and then reading the data bits for transmission when the buffer register is not faulty (the messages in the buffer register are sent in an orderly manner). However, the buffer register may fail. In the event of a failure, method 300 proposes the following handling procedure for the buffer register.
[0061] In one possible implementation, before loading the configuration message into the buffer register of the vehicle controller via the communication bus, the method 300 further includes: detecting whether the buffer register is in a preset state, the preset state indicating that the buffer register is in a fully loaded state for a preset period of time and no data bits are read from the buffer register; if the buffer register is in the preset state, initializing the communication bus system and outputting a reminder message, the reminder message indicating that the buffer register has failed but has been initialized, and retransmitting the configuration message to the radio frequency receiver.
[0062] It should be understood that in the above scheme, if the buffer register remains fully loaded for an extended period without releasing any data bits, it indicates an overall anomaly in the communication bus system, rather than a storage problem with a single buffer register. Therefore, initializing the buffer register is insufficient to resolve the issue. In other words, for buffer register failures, the entire communication bus system needs to be initialized.
[0063] Specifically, the core of initializing the buffer register lies in clearing the accumulated data bits in the buffer register. However, this cannot solve the fundamental problem that causes the buffer register to be filled for a long time without releasing any data bits: the transmission logic of the communication bus malfunctions (such as the state machine getting stuck in a non-transmission state, transmission interrupt failure, or communication handshake failure with the RF receiver). Even if the buffer register is cleared alone, if the transmission logic malfunction is not resolved, new configuration messages still cannot be sent, the buffer register will be filled again, and the RF receiver will still be stuck in polling mode.
[0064] Furthermore, the initialization of the communication bus system in the above scheme refers to a complete reset of the communication link of the communication bus. This complete operation includes clearing all flag bits, restoring default communication parameters, resetting the master state machine of the communication bus, re-enabling the transmit interrupt, clearing the buffer register, restarting the communication handshake process with the RF receiver, and retransmitting the configuration message.
[0065] In the above technical solution, based on the latch flag used to prevent interference from interrupt events and the buffer register used to ensure the continuity of configuration message transmission, the buffer register is checked for pre-set state before loading the configuration message. This allows for early detection of buffer register anomalies, preventing configuration message transmission delays due to buffer register failure. Furthermore, when a buffer register malfunctions, the communication bus system is initialized and an alert message is output. This quickly restores the communication environment and ensures fault traceability. In addition, reminding the resend of the configuration message to the RF receiver compensates for buffer failure scenarios not covered in previous solutions, further improving the anomaly handling mechanism of the configuration process. Simultaneously, it makes the configuration message transmission process more fault-tolerant, improving the stability and reliability of communication between the vehicle controller and the RF receiver.
[0066] Optionally, the preset duration is 5 minutes.
[0067] Figure 4 This is a schematic diagram illustrating the initialization of a communication bus system according to an embodiment of this application. The following is in conjunction with... Figure 4 Describe the triggering conditions for initializing the communication bus system.
[0068] Step 401: Determine whether the vehicle's power supply is on and whether the vehicle's speed is greater than a preset speed. Step 402: If the vehicle's power supply is on and the speed is greater than the preset speed, check whether the buffer register is in a preset state. Step 403: If the buffer register is in the preset state, initialize the communication bus system.
[0069] It should be understood that the above Figure 4The technical solution in the document is a detailed description of "initializing the communication bus system when the buffer register is in the preset state".
[0070] In the above technical solution, the communication bus system is initialized when the vehicle meets the trigger conditions of having its power supply on, its speed exceeding a preset speed, and the buffer register being fully loaded for a preset period of time without reading any data bits from the buffer register. This design addresses scenarios where communication needs are more frequent and reliability requirements are higher during vehicle operation, avoiding unnecessary detection and initialization operations in non-critical states such as when the vehicle is stationary or the power is off. Furthermore, timely troubleshooting of buffer register faults and restoration of communication during driving conditions prevents the RF receiver from being unable to switch modes due to buffer register failure.
[0071] Step 303: If the transmission completion flag of the configuration message exists, control the main state machine to switch from the transmission state to the ready state and clear the latch flag.
[0072] It should be understood that the UART hardware is the physical layer hardware used by the communication bus to send configuration messages. During the configuration message transmission process, the UART hardware controls the transmission of the configuration message bit by bit from the buffer register to the RF receiver. Once the last data bit has been transmitted, the UART hardware will use a transmission completion flag to indicate that the configuration message transmission is complete. That is, step 303 above describes that after sending the configuration message to the RF receiver via the communication bus, the UART hardware checks for the presence of a transmission completion flag; if present, it controls the main state machine to switch to the ready state and clears the latch flag.
[0073] Furthermore, the aforementioned detection of the transmission completion flag involves the vehicle controller actively and pollingly checking the UART hardware for the presence of the transmission completion flag after sending the configuration message to the RF receiver. If the transmission completion flag is present (ensuring the configuration message has been successfully transmitted), the main state machine switches to the ready state. However, in related technologies, the vehicle controller receives an interrupt event carrying a software flag that instructs the main state machine to switch states. This interrupt event is externally triggered, and there is a possibility that it may be triggered prematurely. This interrupt event could disrupt the atomic operations (critical sections) that should be performed during the configuration message transmission process. Even if the vehicle controller receives and responds to the interrupt event, it will still return from the interrupt event's task and continue executing atomic operations. This causes the original software flag to be overwritten, preventing the vehicle controller from determining whether the configuration message has been successfully transmitted, thus preventing the main state machine from initiating a state switch.
[0074] Furthermore, in step 303, after the main control state machine switches from the sending state to the ready state, it can also release the communication bus, allowing the next configuration message to be sent via the communication bus. This also ensures that configuration messages do not clog the buffer register of the vehicle controller when each configuration message is sent according to the above scheme, preventing the buffer register from becoming full.
[0075] It should also be understood that the ready state in step 303 above refers to the standby state in which the communication function of the communication bus is ready, the communication bus can send any configuration message but has not been assigned a sending task.
[0076] Furthermore, clearing the latch flag in step 303 above can be considered as changing the preset value to 0. When the preset value is used to indicate that the transmission process of the configuration message will not be interrupted by an interruption event, indicating that the transmission process is in a shielded state, clearing the latch flag indicates that the aforementioned shielded state has been lifted.
[0077] It should be understood that there are some special cases: the configuration message may not have a completion flag, but the configuration message has still been completely sent. In these special cases, if the main state machine is not switched for an extended period, the main state machine may become stuck, thus affecting the sending of subsequent messages. To address these situations, method 300 also proposes the following embodiments.
[0078] In one possible implementation, after the master state machine controlling the communication bus is adjusted to the transmit state in step 302, method 300 further includes: starting a timeout timer, the duration of which is the sum of the total transmission duration of the configuration message and the response time of the transmission completion flag; and after the configuration message is sent to the radio frequency receiver via the communication bus in step 302, method 300 further includes: determining whether the timeout timer has overflowed if the transmission completion flag is not present; detecting whether the configuration message has been completely transmitted if the timeout timer has overflowed; and controlling the master state machine to switch from the transmit state to the ready state and clearing the latch flag if the configuration message has been completely transmitted.
[0079] It should be understood that in the above scheme, after the master state machine is switched to the transmit state, a configuration message is immediately sent to the RF receiver. Therefore, after switching the master state machine to the transmit state, a timeout timer is started to record the transmission duration of the configuration message. Based on whether the timeout timer overflows, it is determined whether the transmission duration of the configuration message exceeds the normal transmission duration. When the timeout timer overflows, it is checked whether the configuration message has been completely transmitted. This avoids continuously checking whether the configuration message has been completely transmitted, and also ensures that the configuration message has been completely transmitted even when the transmission completion flag is not present, thus smoothly completing the state transition of the master state machine.
[0080] In the above technical solution, while ensuring that the configuration message is not interrupted during the transmission process by using a latch flag, a timeout timer is started before setting the latch flag to a preset value. This allows for setting a reasonable and sufficient time boundary for the transmission process. After sending the configuration message, if the transmission completion flag is not detected, subsequent processing is triggered by checking if the timeout timer has overflowed. After the timeout timer overflows and it is confirmed that the configuration message has been completely sent, the main state machine is controlled to switch from the sending state to the ready state. This mechanism effectively avoids the problem that the main state machine may be stuck in the sending state for a long time due to an abnormal absence of the transmission completion flag, thus preventing it from switching to the ready state and hindering the transmission of other configuration messages. At the same time, it also supplements the state transition guarantee when the transmission completion flag is abnormal, improving the robustness of the configuration process.
[0081] In some embodiments, after determining whether the timeout timer has overflowed, the method 300 further includes: if the timeout timer has not overflowed, continuing to start the timeout timer until the timeout timer overflows.
[0082] In some embodiments, after detecting whether the configuration message has been completely sent, the method 300 further includes: if the configuration message has not been completely sent, continuing to send the configuration message until the configuration message is completely sent.
[0083] In one possible implementation, step 301, setting the latch flag of the radio frequency receiver to a preset value, includes setting the latch flag to the preset value in the memory of the vehicle controller; and step 303, controlling the main state machine to switch from the transmitting state to the ready state and clearing the latch flag, includes controlling the main state machine to switch from the transmitting state to the ready state and clearing the latch flag in the memory.
[0084] It should be understood that in the above scheme, all operations on the latch flag are performed in memory. In the above technical solution, while ensuring that the configuration message transmission process is not interrupted by events through the latch flag, the operation of setting the latch flag to a preset value is explicitly executed in the memory of the vehicle controller, and the subsequent clearing of the latch flag is also performed in memory. This design can solve the problem in related technologies where the flag exists in both memory and registers, leading to inconsistencies in the flag state between the register and memory when updating the flag and there is a transmission delay. This solution controls the latch flag only in memory, ensuring that the setting and clearing of the latch flag are always based on a unified memory storage location, thus avoiding the problem of inconsistent flag states from the source. At the same time, it also makes the control logic and the state transition process of the main state machine, which are designed to prevent interference from interrupt events, more stable.
[0085] In one possible implementation, before setting the latch flag of the radio frequency receiver to a preset value upon detecting a configuration request in step 301, method 300 further includes: detecting whether the vehicle is in sentry mode; and if the vehicle is in sentry mode, controlling the working network segment of the radio frequency receiver to access the target network segment, which is a low-power monitoring network segment.
[0086] It should be understood that the core of the sentry mode in the above scheme lies in low-power monitoring, and the vehicle does not need to keep all network segments constantly active. In sentry mode, any network segment can be dynamically woken up based on actual needs (such as detecting external anomalies), and after completing the corresponding task, the network segment can be put into a dormant state.
[0087] It should also be understood that before the vehicle enters Sentry Mode, the RF receiver operates on three network segments: BD1 (Body Domain 1), BD2 (Body Domain 2), and SC (Surveillance Channel). BD1 and BD2 are sub-segments of the body domain, responsible for transmitting body control signals (such as door status detection signals and lighting control signals), handling routine data exchange with the "body electronics module." The SC segment is primarily a function-specific control segment (such as a sensor communication segment), adapted to the low-power operation requirements of the RF receiver in Sentry Mode. The SC segment is responsible for transmitting interactive data related to the RF receiver (such as tire pressure sensor signals and keyless entry signals), ensuring status monitoring and anomaly response when the vehicle is stationary.
[0088] Furthermore, a network state variable exists within the vehicle, affecting the target operating mode of the RF receiver. In Sentinel mode, if the RF receiver's operating network segment is connected to these three network segments, the following situation occurs: when all three network segments are awake, the network state variable is 1; when one network segment is dormant, the network state variable is 0. In Sentinel mode, when network segments frequently switch between "dormant" and "awakening," it's easy for a situation to occur where "just as all three network segments are activated (network state variable is 1), the next second a network segment goes dormant (network state variable becomes 0)," meaning the network state variable frequently switches between 0 and 1. This necessitates frequent changes to the target operating mode, leading to a high frequency of configuration messages being sent to the RF receiver.
[0089] For example, when all three network segments are awakened, the network state variable is 1, and the target operating mode can be constant receive mode. When one network segment is dormant, the network state variable is 0, and the target operating mode can be polling mode.
[0090] In the above technical solution, while ensuring that the configuration message is not interrupted during the transmission process by using a latch flag, the system checks whether the vehicle is in sentry mode before setting the latch flag to a preset value. Sentry mode is the mode in which the vehicle is under security monitoring. In sentry mode, the vehicle is off but maintains awareness of its surroundings. In this low-power state, the solution controls the RF receiver's operating network segment to connect to a low-power target network segment. This avoids increasing the RF receiver's power consumption when using other network segments in sentry mode, thus extending battery life when the vehicle is stationary. Simultaneously, this target network segment is optimized for monitoring scenarios, ensuring stable transmission of critical monitoring signals in sentry mode. Furthermore, it allows configuration requests to be executed in a network environment adapted to sentry mode, improving communication adaptability and overall vehicle energy efficiency in special modes.
[0091] In some embodiments, after detecting whether the vehicle is in sentry mode, the method 300 further includes: if the vehicle is not in sentry mode, controlling the radio frequency receiver to maintain the current working network segment.
[0092] In some embodiments, the target network segment is an SC network segment. After controlling the working network segment of the radio frequency receiver to access the target network segment, the method 300 further includes: when the SC network segment is in a dormant state, the target working mode is a polling mode; when the SC network segment is in a wake-up state, the target working mode is a constant receiving mode.
[0093] In one possible implementation, before clearing the latch flag in step 303, method 300 further includes: detecting whether an interrupt event is received; if an interrupt event is received, detecting whether the latch flag has been cleared; if the latch flag has not been cleared, returning the interrupt event along the original path.
[0094] It should be understood that the above scheme describes a process where, in the event of an interruption, if the latch flag is not cleared, the interruption event is not responded to. This avoids interrupting the configuration process of configuration messages due to interruption events. Simultaneously, returning the interruption event along its original path also informs the sender of the interruption event that it has not been processed.
[0095] In the above technical solution, while ensuring that the configuration message is not interrupted by events during the transmission process through the latch flag, an interrupt event is detected before clearing the latch flag. If an interrupt event is received, it is checked whether the latch flag has been cleared. If the latch flag has not been cleared, the interrupt event is returned along the original path. This design strengthens the protection of the critical section, ensuring that no interrupt event will interfere while the latch flag is still valid (i.e., the configuration process is not yet complete). This avoids state machine chaos or interruption of the configuration process caused by an interrupt event being accidentally triggered before the latch flag is cleared, making the logic of "transmission process not being interrupted" more rigorous, further ensuring the atomicity and stability of the main state machine's state transitions, and improving the reliability of the communication process.
[0096] In some embodiments, after detecting whether the latch flag has been cleared, the method 300 further includes: if the latch flag has been cleared, processing the interrupt event, obtaining a processing result, and sending the processing result to the sending end of the interrupt event.
[0097] Figure 5 This is a schematic diagram of a state switching device provided in an embodiment of this application.
[0098] For example, the device is executed by a vehicle controller in a vehicle, which also includes a radio frequency receiver. The vehicle controller communicates with the radio frequency receiver via a communication bus, such as... Figure 5 As shown, the device 500 includes: Setting module 501 is used to set the latch flag position of the radio frequency receiver to a preset value when a configuration request is detected. The configuration request is used to request that the actual working mode of the radio frequency receiver be configured to the target working mode. The preset value is used to indicate that the transmission process of the configuration message corresponding to the configuration request will not be interrupted by the interruption event. The transmitting module 502 is used to control the state of the master state machine of the communication bus to be adjusted to the transmitting state, and to send the configuration message to the radio frequency receiver through the communication bus; The clearing module 503 is used to control the main state machine to switch from the sending state to the ready state and clear the latching flag when the sending completion flag of the configuration message is present.
[0099] Optionally, after the state of the master state machine controlling the communication bus is adjusted to the transmit state, the device 500 further includes: a startup module for starting a timeout timer, the duration of which is the sum of the total transmission duration of the configuration message and the response time of the transmission completion flag; and, after the configuration message is transmitted to the radio frequency receiver via the communication bus, the device 500 further includes: a determination module for determining whether the timeout timer has overflowed if the transmission completion flag is not present; a detection module for detecting whether the configuration message has been completely transmitted if the timeout timer has overflowed; and a clearing module 503 specifically for controlling the master state machine to switch from the transmit state to the ready state and clearing the latch flag if the configuration message has been completely transmitted.
[0100] Optionally, before clearing the latch flag, the detection module is further configured to: detect whether an interrupt event has been received; if an interrupt event is received, detect whether the latch flag has been cleared; the sending module 502 is further configured to return the interrupt event along the original path if the latch flag has not been cleared.
[0101] Optionally, the setting module 501 is specifically used to set the latch flag to the preset value in the memory of the vehicle controller; and the clearing module 503 is specifically used to control the main state machine to switch from the sending state to the ready state and clear the latch flag in the memory.
[0102] Optionally, the transmitting module 502 is specifically configured to load the configuration message into the buffer register of the vehicle controller via the communication bus, and read each data bit from the buffer register and transmit it to the radio frequency receiver; and after transmitting the configuration message to the radio frequency receiver via the communication bus, the determining module is further configured to: determine whether there is a configuration message in the buffer register; and if there is no configuration message in the buffer register, determine whether there is a transmission completion flag bit.
[0103] Optionally, before loading the configuration message into the buffer register of the vehicle controller via the communication bus, the detection module is further configured to detect whether the buffer register is in a preset state. The preset state indicates that the buffer register is in a fully loaded state for a preset period of time and no data bits are read from the buffer register. The device 500 further includes an output module, configured to initialize the communication bus system and output a reminder message when the buffer register is in the preset state. The reminder message is used to remind that the buffer register has failed but has been initialized, and to resend the configuration message to the radio frequency receiver.
[0104] Optionally, upon detecting a configuration request, before setting the latch flag of the RF receiver to a preset value, the detection module is further configured to detect whether the vehicle is in sentry mode; the device 500 also includes: an access module, configured to control the working network segment of the RF receiver to access a target network segment when the vehicle is in sentry mode, the target network segment being a low-power monitoring network segment.
[0105] Figure 6 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application.
[0106] For example, such as Figure 6 As shown, the vehicle 600 includes a memory 601 and a processor 602. The memory 601 stores executable program code 603, and the processor 602 is used to call and execute the executable program code 603 to perform a state switching method.
[0107] Furthermore, embodiments of this application also protect an apparatus that may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a state switching method provided in embodiments of this application.
[0108] This embodiment can divide the device into functional modules based on the above method example. For example, each module can correspond to a separate function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0109] When each functional module is divided according to its corresponding function, the device may further include a setting module, a sending module, a clearing module, a starting module, a determining module, a detection module, an output module, and an access module. It should be noted that all relevant content in the above method embodiments can be referenced to the functional descriptions of the corresponding functional modules, and will not be repeated here.
[0110] It should be understood that the apparatus provided in this embodiment is used to execute the above-described state switching method, and therefore can achieve the same effect as the above-described implementation method.
[0111] When using an integrated unit, the device may include a processing module and a storage module. When the device is applied to a vehicle, the processing module can be used to control and manage the vehicle's movements. The storage module can be used to support the vehicle in executing relevant executable program code.
[0112] The processing module may be a processor or a controller, which can implement or execute various exemplary logic blocks, modules, and circuits shown in conjunction with the disclosure of this application. The processor may also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc., and the storage module may be a memory.
[0113] In addition, the apparatus provided in the embodiments of this application may specifically be a chip, component or module. The chip may include a connected processor and a memory. The memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute a state switching method provided in the above embodiments.
[0114] This embodiment also provides a computer-readable storage medium storing executable program code. When the executable program code is run on a computer, it causes the computer to perform the aforementioned method steps to implement a state switching method provided in the above embodiment.
[0115] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned related steps to implement a state switching method provided in the above embodiment.
[0116] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0117] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0118] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0119] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for state switching, characterized in that, The method is executed by a vehicle controller in the vehicle, which also includes a radio frequency receiver. The vehicle controller communicates with the radio frequency receiver via a communication bus. The method includes: Upon detecting a configuration request, the latch flag of the radio frequency receiver is set to a preset value. The configuration request is used to request that the actual operating mode of the radio frequency receiver be configured to the target operating mode. The preset value is used to indicate that the transmission process of the configuration message corresponding to the configuration request will not be interrupted by an interruption event. The master state machine controlling the communication bus is adjusted to the transmit state, and the configuration message is sent to the radio frequency receiver through the communication bus; If the configuration message has a transmission completion flag, control the main state machine to switch from the transmission state to the ready state and clear the latch flag.
2. The method according to claim 1, characterized in that, After the master state machine controlling the communication bus is adjusted to the transmit state, the method further includes: Start a timeout timer, the duration of which is the sum of the total transmission time of the configuration message and the response time of the transmission completion flag bit; And, after sending the configuration message to the radio frequency receiver via the communication bus, the method further includes: If the transmission completion flag is not present, determine whether the timeout timer has overflowed; In the event of a timeout, check whether the configuration message has been completely sent. When the configuration message has been completely sent, the master state machine is controlled to switch from the sending state to the ready state, and the latch flag is cleared.
3. The method according to claim 1, characterized in that, Before clearing the latch flag, the method further includes: Check if an interrupt event has been received; Upon receiving an interrupt event, check whether the latch flag has been cleared; If the latch flag is not cleared, the interrupt event will be returned along the original path.
4. The method according to claim 1, characterized in that, Setting the latch flag position of the radio frequency receiver to a preset value includes: In the memory of the vehicle controller, the latch flag is set to the preset value; And, the step of controlling the main state machine to switch from the sending state to the ready state and clearing the latch flag includes: The main state machine is controlled to switch from the sending state to the ready state, and the latch flag in the memory is cleared.
5. The method according to any one of claims 1-4, characterized in that, The step of sending the configuration message to the radio frequency receiver via the communication bus includes: The configuration message is loaded into the buffer register of the vehicle controller via the communication bus, and each data bit is read from the buffer register and sent to the radio frequency receiver. And, after sending the configuration message to the radio frequency receiver via the communication bus, the method further includes: Determine whether a configuration message exists in the buffer register; If no configuration message is present in the buffer register, determine whether the transmission completion flag is present.
6. The method according to claim 5, characterized in that, Before loading the configuration message into the buffer register of the vehicle controller via the communication bus, the method further includes: Detect whether the buffer register is in a preset state, the preset state being used to indicate that the buffer register is in a fully loaded state for a preset time period and no data bits are read from the buffer register; When the buffer register is in the preset state, the communication bus system is initialized and a reminder message is output. The reminder message is used to remind that the buffer register has failed but has been initialized, and to resend the configuration message to the radio frequency receiver.
7. The method according to any one of claims 1-4, characterized in that, Before setting the latch flag of the radio frequency receiver to a preset value upon detecting a configuration request, the method further includes: Detect whether the vehicle is in sentry mode; When the vehicle is in the sentry mode, the operating network segment of the radio frequency receiver is controlled to access the target network segment, which is a low-power monitoring network segment.
8. A state switching device, characterized in that, The device is executed by a vehicle controller in the vehicle, which also includes a radio frequency receiver. The vehicle controller communicates with the radio frequency receiver via a communication bus. The device includes: The setting module is used to set the latch flag of the radio frequency receiver to a preset value when a configuration request is detected. The configuration request is used to request that the actual working mode of the radio frequency receiver be configured to the target working mode. The preset value is used to indicate that the sending process of the configuration message corresponding to the configuration request will not be interrupted by the interruption event. The transmitting module is used to control the state of the master state machine of the communication bus to be adjusted to the transmitting state, and to send the configuration message to the radio frequency receiver through the communication bus; The clearing module is used to control the main state machine to switch from the sending state to the ready state and clear the latch flag when the sending completion flag of the configuration message is present.
9. A vehicle, characterized in that, The vehicles include: Memory, used to store executable program code; A processor for calling and running the executable program code from the memory, causing the vehicle to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores executable program code that, when executed, implements the method as described in any one of claims 1 to 7.