comparison Discovery/Src/data_exchange_main.c @ 89:ff7775cc34c4 kittz

temp! full cyclic SPI
author Dmitry Romanov <kitt@bk.ru>
date Fri, 23 Nov 2018 16:52:21 +0300
parents 3db7389d49cc
children 83857eb3b12b
comparison
equal deleted inserted replaced
88:3db7389d49cc 89:ff7775cc34c4
304 uint8_t DataEX_call(void) 304 uint8_t DataEX_call(void)
305 { 305 {
306 uint8_t SPI_DMA_answer = 0; 306 uint8_t SPI_DMA_answer = 0;
307 307
308 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET); 308 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
309 delayMicros(10); //~exchange time(+20% reserve) 309 delayMicros(30); //~exchange time(+20% reserve)
310 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET); 310 HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
311 /* one cycle with NotChipSelect true to clear slave spi buffer */ 311 /* one cycle with NotChipSelect true to clear slave spi buffer */
312 312
313 if(data_old__lost_connection_to_slave_counter_temp >= 3) 313 if(data_old__lost_connection_to_slave_counter_temp >= 3)
314 { 314 {
324 324
325 systick_last = HAL_GetTick(); 325 systick_last = HAL_GetTick();
326 326
327 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */ 327 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */
328 328
329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1); 329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE);
330 // HAL_Delay(3); 330 // HAL_Delay(3);
331 if(SPI_DMA_answer != HAL_OK) 331 if(SPI_DMA_answer != HAL_OK)
332 DataEX_Error_Handler(SPI_DMA_answer); 332 DataEX_Error_Handler(SPI_DMA_answer);
333 //HAL_Delay(3); 333 //HAL_Delay(3);
334 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */ 334 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */