Network reconnection problem BUG solution

  In the past, the network drop detection function was added to the transplanted LWIIP protocol. At that time, the test passed and the detection was normal. Refer to the method of adding the network drop function. See http://www.stmcu.org/module/forum/thread-586493- 6# comment in 1-1.html .

During the overall functional test recently, it was found that the network disconnection detection module was running abnormally, the system tick clock was still running, and the detection function was working abnormally. If it was placed before the main control program, it could be detected if it was disconnected. It is found that the statement is stuck in the delay function through simulation. Through JLINK simulation, it is found that there is a delay time value in the delay statement, but the detection time value has not been updated, and the updated flag is always 0, which is normal. Next, enter this function, first the delay flag will be set, and then in the tick clock interrupt function, the delay time is updated by detecting the flag, and the accurate delay based on the tick clock is completed by comparing the update value and the delay time value. Time. ·  

By searching for the delay time, it is located in the network read delay statement. The network delay statement is actually run in the main control program. When the delay is entered, the cycle interrupt in the cycle command also calls the delay statement, but the delay statement Including global variables, it is not reentrant. When the interrupt is entered, the delay statement is called and the flag bit is cleared after the delay is completed. After the interrupt is out, the original delay instruction cannot work normally because the delay flag bit is cleared. Causes the phenomenon that control programs such as network disconnection detection do not work. This is also the reason why the detection is placed before the control, and it can be disconnected to detect, but it will also cause a functional error when plugged in, because the loop interrupt instruction has not yet run before the control instruction.

                                      

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324840155&siteId=291194637