changeset 726:8f3a8c85a6c4

Bugfix data synchronization after RTE start: In previous version invalid data may be transferred in case the communication is corrupted directly after RTE startup. Root cause was that the data was evaluated without caring if a communication error was reported. In the new version the startup condition and evaluation of data is only done if valid data has been received by the RTE => SPI communication is up and runnig.
author Ideenmodellierer
date Sat, 14 Jan 2023 20:35:40 +0100
parents 621265ec3d23
children 1dca3bb187d7
files Small_CPU/Src/spi.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Small_CPU/Src/spi.c	Sat Jan 07 18:11:52 2023 +0100
+++ b/Small_CPU/Src/spi.c	Sat Jan 14 20:35:40 2023 +0100
@@ -409,10 +409,13 @@
 				HAL_SPI_TransmitReceive_DMA(&hspi1,(uint8_t*) &(global.dataSendToMaster),(uint8_t*) &(global.dataSendToSlave), EXCHANGE_BUFFERSIZE);
 		}
 
-		global.dataSendToMaster.power_on_reset = 0;
-		global.deviceDataSendToMaster.power_on_reset = 0;
+		if(global.dataSendToSlaveIsValid)
+		{
+			global.dataSendToMaster.power_on_reset = 0;
+			global.deviceDataSendToMaster.power_on_reset = 0;
 
-		scheduleSpecial_Evaluate_DataSendToSlave();
+			scheduleSpecial_Evaluate_DataSendToSlave();
+		}
 
 		if(resettimeout)
 		{