2022-09-21 10:42 PM
Hi
I am following the AN4666 document to receive parallel gpio data, with on clock input.
this is the code I wrote : I was expecting to receive gpio data and save to memory by triggering the DMA at every rising edge my issue is that the timer (input capture mode ) only detects the first rising once and save GPIO value in the first array once and then stops making whats left of my buffer equal to 0.
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32h7xx_ll_tim.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#define BUFFER_SIZE 100
static uint8_t aDST_Buffer[BUFFER_SIZE] = {0};
int main(void)
{
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART3_UART_Init();
MX_USB_OTG_FS_PCD_Init();
MX_TIM1_Init();
MX_DMA_Init();
// Start DMA in interrupt mode, specify source and destination
HAL_DMA_Start_IT(htim1.hdma[TIM_DMA_ID_CC1], GPIOC_IDR, (uint32_t) &aDST_Buffer, 10);
// Enable timer to trigger DMA transfer - CC1DE bit
__HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_CC1);
// Enable timer to trigger DMA transfer - CC1DE bit
__HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_CC1);
while (1) {}
}
Solved! Go to Solution.
2022-09-22 05:22 AM
Hello @AElta.1 ,
Maybe it's related to this issue: DMA not working in CubeMX generated code - order of initialization
So, the MX_DMA_Init shall always be called before any other peripheral initialization, as mentioned in this post.
I hope this helps ! If this the case, please close this post by clicking the Select as Best button on my reply .
Imen
2022-09-22 05:22 AM
Hello @AElta.1 ,
Maybe it's related to this issue: DMA not working in CubeMX generated code - order of initialization
So, the MX_DMA_Init shall always be called before any other peripheral initialization, as mentioned in this post.
I hope this helps ! If this the case, please close this post by clicking the Select as Best button on my reply .
Imen