我试图以DMA模式实现DFSDM,所以我使用CubeMX生成了代码,并以循环模式配置了DFSDM DMA。
每当我在调试模式下运行代码时,都会看到在DMA IRQ处理程序内部,它调用CpltCallback而不是HalfCpltCallback。
我的问题是为什么它调用CpltCallback而不是HalfCpltCallback?以及如何处理?
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_DFSDM1_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
HAL_UART_Transmit(&huart2, "\r\nHello\r\n", sizeof("\r\nHello\r\n"), HAL_MAX_DELAY);
uint8_t cr = 1;
HAL_UART_Receive_IT(&huart2, cr, 1);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
if(flag == 1)
{
for (int j = 0; j<taille; j++)
{
sprintf(tab, "%05d", (int)val[j]/256);
HAL_UART_Transmit(&huart2, tab, 5, HAL_MAX_DELAY);
HAL_UART_Transmit(&huart2, ",", 1, HAL_MAX_DELAY);
}
HAL_UART_Transmit(&huart2, "\r\n", 2, HAL_MAX_DELAY);
flag = 0;
HAL_UART_Receive_IT(&huart2, cr, 1);
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
/**
* @brief System Clock Configuration
* @retval None
*/
void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_DFSDM_FilterRegularStop_DMA(&hdfsdm1_filter0);
HAL_GPIO_TogglePin(LD4_GPIO_Port, LD4_Pin);
flag = 1;
}
void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_GPIO_TogglePin(LD4_GPIO_Port, LD4_Pin);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_GPIO_TogglePin(LD4_GPIO_Port, LD4_Pin);
HAL_DFSDM_FilterRegularStart_DMA(&hdfsdm1_filter0, &val, taille);
}