diff Small_CPU/Src/scheduler.c @ 265:a91d99265884 IPC_Sync_Improvment_2

Increase SPI com timeout for cold start and wake up There are use cases which cause the startup at Main to be longer than 300ms. In that case error reaction on RTE side would take place even if not needed. On the other hand having an longer timeout delays timeout detection and therefor the time till connection is reestablished => Added function to separate startup from common operation use case
author ideenmodellierer
date Sun, 14 Apr 2019 14:22:41 +0200
parents b3685fbada3b
children 580822b5d3d1
line wrap: on
line diff
--- a/Small_CPU/Src/scheduler.c	Sun Apr 14 11:43:29 2019 +0200
+++ b/Small_CPU/Src/scheduler.c	Sun Apr 14 14:22:41 2019 +0200
@@ -172,6 +172,7 @@
 	global.deviceData.temperatureMinimum.value_int32 = INT32_MAX;
 	global.deviceData.voltageMinimum.value_int32 = INT32_MAX;
 
+	Scheduler.communicationTimeout = SPI_COM_TIMEOUT_START;
 	Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD);
 }
 
@@ -182,6 +183,7 @@
 	global.dataSendToSlaveIsNotValidCount = 0;
 	global.sync_error_count = 0;
 	global.check_sync_not_running = 0;
+	Scheduler.communicationTimeout = SPI_COM_TIMEOUT_START;
 }
 
 void scheduleSpecial_Evaluate_DataSendToSlave(void)
@@ -410,7 +412,7 @@
 void schedule_check_resync(void)
 {
 	/* counter is incremented in cyclic 100ms loop and reset to 0 if the transmission complete callback is called */
-	if((global.check_sync_not_running >= 5))
+	if((global.check_sync_not_running >= Scheduler.communicationTimeout))
 	{
 //		global.dataSendToSlaveIsNotValidCount = 0;
 		global.check_sync_not_running = 0;
@@ -420,6 +422,7 @@
 		 * function error handler
 		 */
 		SPI_Start_single_TxRx_with_Master();
+		Scheduler.communicationTimeout = SPI_COM_TIMEOUT_COMMON;	/* Reduce error detection time */
 		Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD);
 	}
 }