cancel
Showing results for 
Search instead for 
Did you mean: 

GPDMA GPIO Output Configuration issues

eosella
Associate II

Hello I'm working with a nucleo u575zi-q board where i've to set many GPIO pins in a synchronos way using GPDMA. I've successfully used the DAC and DMA example in the IDE, but Igot stacked with the GPIO output.

I followed the case posted here, triyed with different timers, etc, but couldn't get it on work.

eosella_0-1731528409822.png

eosella_1-1731528445898.png

 

In the user code section on main I stated as follows

 

 

 

/* USER CODE BEGIN 2 */

  uint32_t gpiovales[10] = {0x0,0x01,0x02,0x03,0x08,0x09,0x0A,0x0B}; //I use GPIOB0,1,2, and 4
  HAL_DMA_Start(&handle_GPDMA1_Channel11, (uint32_t) gpiovales, (uint32_t)&(GPIOB->BSRR), 10);
  HAL_TIM_Base_Start(&htim1);
  HAL_TIM_OC_Start(&htim1, TIM_CHANNEL_1);
  TIM1->DIER |= (1<<8); // updates the dma request enable
  /* USER CODE END 2 */

 

 

 

Any help / orientation will be helpful

9 REPLIES 9
Sarra.S
ST Employee

Hello @eosella

Have you tested that the timers are correctly running and generating the correct update events? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

SofLit
ST Employee

Hello @eosella ,

Better to share your ioc file instead of several screenshots. Some info could be hidden and not exposed to us.

Thank you.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Attached you can find the IOC file.

I implemented the callback function

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
	if(htim->Instance == TIM1)
		HAL_GPIO_TogglePin(LED_BLUE_GPIO_Port, LED_BLUE_Pin);
}

 

but never enters there. Don't know if it's a misunderstanding of which function I should check or if I've misconfigurated / initilized the timer.


@eosella wrote:

Attached you can find the IOC file.


No ioc file attached ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Check first the counter register is it incrementing or not.

 


@eosella wrote:

I implemented the callback function

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
	if(htim->Instance == TIM1)
		HAL_GPIO_TogglePin(LED_BLUE_GPIO_Port, LED_BLUE_Pin);
}

 

but never enters there. Don't know if it's a misunderstanding of which function I should check or if I've misconfigurated / initilized the timer.


Here you are talking about the interrupt. Need to check if you already enabled the TIM interrupt. (NVIC).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Sorry, let's see if it attaches now. The NVIC configuration is generated only in the GPDMA section

Sarra.S
ST Employee

Hello @eosella

I've noted that the GPDMA configuration is not totally correct in your .ioc file, you're trying the use GPDMA in standard request mode, however, in the GPDMA1 configuration, "transfer event configuration", you're choosing the wrong configuration for linked list mode: 

SarraS_0-1731661967048.png

 Instead, it should be: 

SarraS_1-1731662004107.png

Also, you should use HAL_TIM_Base_Start_IT(&htim1) which is necessary for the HAL_TIM_PeriodElapsedCallback function to be called (that's why it never enters there).  The HAL_TIM_Base_Start(&htim1) function only starts the timer without enabling its interrupt, which means the callback function will not be triggered.

 

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sorry, but it didn't worked ... :( Basically, what I need to do is to deliver some DAC values to a specific channels, whose CS are triggered by the GPIO. My first attempt was to create two dma channels, one to the GPIOs and the other to the DAC, both triggered by the same source ... but I ended without results.

I've also tryed to follow but didn't succedded.

Currently, I considered a LLI (trying to follow the example in https://www.youtube.com/watch?v=AHKDPWKN30E ), triggered by a timer and a first node in the queue moves the GPIOB->ODR and the second node puts the DAC1->DOR1 value . But unfortunatelly, none of them are performed.

Don't know if this is a right approach for this problem, any help will be appreciated.