Skip to content

Commit a8fb8f0

Browse files
committed
Fix Bluetooth test hang
The hang is most likely a hang in the peripheral bus arbitrator for UART2 where both CPUs are trying to access UART2, one to set the baudrate and the other to read another character from the device or check UART2 status. Since the tasks are cooperative multitasking it is possible that one of the UART2 tasks is executing at the time the vTaskDelete call is made. The vTask call most likely this call only marks the task for deletion, but does not wait for the deletion of the task. The task may not get deleted until it enters the ready state again. Adding a delay after the vTaskDelete allows the tasks to exit and the task deletion to complete. As such, only one task is running that is attempting to access the UART. Testing was done by modifying menuSystem in menuSystem.ino to place the Bluetooth test into a while(1) loop and to print a loop count for each pass through the test. Testing has gone on for over 2.5 hours and the loop count has exceeded 170,000.
1 parent d9591db commit a8fb8f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ void stopUART2Tasks()
385385
vTaskDelete(F9PSerialWriteTaskHandle);
386386
F9PSerialWriteTaskHandle = NULL;
387387
}
388+
389+
//Give the other CPU time to finish
390+
//Eliminates CPU bus hang condition
391+
delay(10);
388392
}
389393

390394
void beginFS()

0 commit comments

Comments
 (0)