comparison Discovery/Src/data_exchange_main.c @ 104:22a1094545f3 kittz

Tested and alive.
author Dmitry Romanov <kitt@bk.ru>
date Mon, 24 Dec 2018 16:15:02 +0300
parents 6a2308b9a3d4
children 3834b6272ee5
comparison
equal deleted inserted replaced
103:f5d2f02dc73f 104:22a1094545f3
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(50); //~exchange time(+20% reserve) 309 delayMicros(20); //~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 {
328 328
329 SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE); 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_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
333 //HAL_Delay(3); 334 //HAL_Delay(3);
334 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */ 335 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */
335 336
336 return 1; 337 return 1;
337 } 338 }