cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx Bug - DMA interrupt

levak
Associate II
Posted on April 01, 2014 at 12:38

STM32CubeMx generate code for STM32F407VGTx

I chek box '' DMA2 Stream0 global interrupt'' in '' NVIC Configuration'' STM32CubeMx not add in stm32f4xx_hal_msp.c - HAL_NVIC_EnableIRQ:

void
HAL_ADC_MspInit(ADC_HandleTypeDef* hadc){

GPIO_InitTypeDef GPIO_InitStruct;

if
(hadc->Instance==ADC1)

{

...

HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn); 
// No Add

}

}

#stm32cubemx-dma-interrupt-nvic
7 REPLIES 7
stm32cube-t
Senior III
Posted on April 02, 2014 at 10:50

Hello Alex,

Can you please describe what you want to do. You are showing ADC related initialization code below.

Thanks.

talbi.amel
Associate II
Posted on April 02, 2014 at 11:47

Hello,

This is fixed in the latest available release of STM32CubeMX.

The initialization code of interrupt for DMA will be generated into the void MX_DMA_Init(void) as bellow:

void MX_DMA_Init(void) 

{

  /* DMA controller clock enable */

  __DMA2_CLK_ENABLE();

  /* DMA interrupt init */

  /* Sets the priority grouping field */

  HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);

  HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 0, 0);

  HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);

}

levak
Associate II
Posted on April 02, 2014 at 15:22

All right. It works. Question 2. Why DMA Continuous Requests only available when Independent mode? 

talbi.amel
Associate II
Posted on April 03, 2014 at 09:42

If you switch to a multiple mode (dual or triple), and if it is possible to use the DMA transfer, you have to use the ''DMA Access Mode'' parameter that will be available in the common settings section.

  0690X00000605bqQAA.png

Best regards,

Amel.

levak
Associate II
Posted on April 03, 2014 at 10:13

STM32Cube_FW_F4_V1.1.0\Projects\STM324x9I_EVAL\Examples\ADC\ADC_DualModeInterleaved\Src\main.c

0690X00000605bWQAQ.png

If AdcHandle1.Init.DMAContinuousRequests = ENABLE; is removed, the DMA interrupt is not activated.

STM32CubeMx does not add this line.

talbi.amel
Associate II
Posted on April 03, 2014 at 16:54

The DMA is activated by the setting of the DMA bit in the CCR register. 

but the DMAContinuousMode parameter is used to set the DDS bit that is used to be able to transfer data  continuously (Reference Manual: Requests can continue to be generated if the DDS bit is set to 1. This allows

configuring the DMA in double-buffer circular mode).

For the tool, you are right, this parameter should be also available for ADC multiple mode.

This will be fixed in the next release.

Best regards,

Amel.

levak
Associate II
Posted on April 08, 2014 at 12:55

In version 4.1.0 you broke change ADC channels, changes are not saved. (saved, but they differ sorce code.)

0690X00000605ePQAQ.png

0690X00000605Z6QAI.png

0690X00000605eFQAQ.png