diff Discovery/Src/data_exchange_main.c @ 87:e746bf846638 kittz

tmp
author Dmitry Romanov <kitt@bk.ru>
date Wed, 21 Nov 2018 13:57:58 +0300
parents a6f0881074a4
children 3db7389d49cc
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c	Wed Nov 21 13:12:44 2018 +0300
+++ b/Discovery/Src/data_exchange_main.c	Wed Nov 21 13:57:58 2018 +0300
@@ -306,8 +306,8 @@
 	uint8_t SPI_DMA_answer = 0;
 	
 	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
-	delayMicros(10);
-
+	delayMicros(50); //~exchange time(+20% reserve)
+	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
 	/* one cycle with NotChipSelect true to clear slave spi buffer */
 
 	if(data_old__lost_connection_to_slave_counter_temp >= 3)
@@ -315,10 +315,10 @@
 		data_old__lost_connection_to_slave_counter_temp = 0;
 		data_old__lost_connection_to_slave_counter_retry++;
 	}
-	else
-	{
-		HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
-	}
+//	else
+//	{
+//		HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
+//	}
 
 	DataEx_call_helper_requests();
 
@@ -327,7 +327,7 @@
 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */
 
 	SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1);
-	HAL_Delay(3);
+//	HAL_Delay(3);
 	if(SPI_DMA_answer != HAL_OK)
     DataEX_Error_Handler(SPI_DMA_answer);
 //HAL_Delay(3);