Mercurial > public > ostc4
comparison 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 |
comparison
equal
deleted
inserted
replaced
264:b3685fbada3b | 265:a91d99265884 |
---|---|
170 global.deviceData.hoursOfOperation.value_int32 = 0; | 170 global.deviceData.hoursOfOperation.value_int32 = 0; |
171 global.deviceData.temperatureMaximum.value_int32 = INT32_MIN; | 171 global.deviceData.temperatureMaximum.value_int32 = INT32_MIN; |
172 global.deviceData.temperatureMinimum.value_int32 = INT32_MAX; | 172 global.deviceData.temperatureMinimum.value_int32 = INT32_MAX; |
173 global.deviceData.voltageMinimum.value_int32 = INT32_MAX; | 173 global.deviceData.voltageMinimum.value_int32 = INT32_MAX; |
174 | 174 |
175 Scheduler.communicationTimeout = SPI_COM_TIMEOUT_START; | |
175 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); | 176 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); |
176 } | 177 } |
177 | 178 |
178 void reinitGlobals(void) | 179 void reinitGlobals(void) |
179 { | 180 { |
180 global.dataSendToSlavePending = 0; | 181 global.dataSendToSlavePending = 0; |
181 global.dataSendToSlaveIsValid = 0; | 182 global.dataSendToSlaveIsValid = 0; |
182 global.dataSendToSlaveIsNotValidCount = 0; | 183 global.dataSendToSlaveIsNotValidCount = 0; |
183 global.sync_error_count = 0; | 184 global.sync_error_count = 0; |
184 global.check_sync_not_running = 0; | 185 global.check_sync_not_running = 0; |
186 Scheduler.communicationTimeout = SPI_COM_TIMEOUT_START; | |
185 } | 187 } |
186 | 188 |
187 void scheduleSpecial_Evaluate_DataSendToSlave(void) | 189 void scheduleSpecial_Evaluate_DataSendToSlave(void) |
188 { | 190 { |
189 //TEMPORARY fix for compass calibration. | 191 //TEMPORARY fix for compass calibration. |
408 */ | 410 */ |
409 | 411 |
410 void schedule_check_resync(void) | 412 void schedule_check_resync(void) |
411 { | 413 { |
412 /* counter is incremented in cyclic 100ms loop and reset to 0 if the transmission complete callback is called */ | 414 /* counter is incremented in cyclic 100ms loop and reset to 0 if the transmission complete callback is called */ |
413 if((global.check_sync_not_running >= 5)) | 415 if((global.check_sync_not_running >= Scheduler.communicationTimeout)) |
414 { | 416 { |
415 // global.dataSendToSlaveIsNotValidCount = 0; | 417 // global.dataSendToSlaveIsNotValidCount = 0; |
416 global.check_sync_not_running = 0; | 418 global.check_sync_not_running = 0; |
417 global.sync_error_count++; | 419 global.sync_error_count++; |
418 | 420 |
419 /* Try to start communication again. If exchange is stuck during execution for some reason the TX will be aborted by the | 421 /* Try to start communication again. If exchange is stuck during execution for some reason the TX will be aborted by the |
420 * function error handler | 422 * function error handler |
421 */ | 423 */ |
422 SPI_Start_single_TxRx_with_Master(); | 424 SPI_Start_single_TxRx_with_Master(); |
425 Scheduler.communicationTimeout = SPI_COM_TIMEOUT_COMMON; /* Reduce error detection time */ | |
423 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); | 426 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); |
424 } | 427 } |
425 } | 428 } |
426 | 429 |
427 | 430 |