2025-04-23 3:51 PM
Hello friends
I don't know what to do and I'm going to ask for help, in my project I use SPI and Full-Duplex mode with the following configuration which works perfectly in this mode. My problem is that I need to use Half-Duplex mode because on hardware I have output data from AD7686 connected to the MOSI pin which I need to read using DMA which is triggered by a timer. Here is the configuration which works for me but only in Fuul-Duplex mode.
Timer 2 is used to trigger DMA and the CH1 output generates the CNV signal for the AD7686
SET_BIT(SPI2->CR2,SPI_CR2_RXDMAEN);
HAL_DMA_Start_IT(&hdma_spi2_rx,(uint32_t)&(SPI2->DR),(uint32_t)U_RX_buf,U_RX_BUF_SIZE);
__HAL_SPI_ENABLE(&hspi2);
HAL_DMA_Start(&hdma_tim2_ch1,(uint32_t)&tx_buffer,(uint32_t)&(SPI2->DR),1);
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_1);
__HAL_TIM_ENABLE_DMA(&htim2,TIM_DMA_CC1);