2024-11-13 12:11 PM - last edited on 2024-11-14 05:20 AM by Sarra.S
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.
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
2024-11-14 06:07 AM
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.
2024-11-14 06:12 AM
Hello @eosella ,
Better to share your ioc file instead of several screenshots. Some info could be hidden and not exposed to us.
Thank you.
2024-11-14 08:57 AM
Attached you can find the IOC file.
2024-11-14 09:00 AM
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.
2024-11-14 09:12 AM
@eosella wrote:
Attached you can find the IOC file.
No ioc file attached ..
2024-11-14 09:14 AM
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).
2024-11-14 10:01 AM
2024-11-15 01:20 AM
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:
Instead, it should be:
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.
2024-11-19 11:27 AM
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.