cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with LL DMA Library

senge
Associate II

Hello

some LL DMA commands do not work correctly.

CubeMX generates the following SPI/DMA init code:

...
 GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
 GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
 LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
  /* SPI2 DMA Init */
  
  /* SPI2_TX Init */
  LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_5, LL_DMA_REQUEST_1);
 
  LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5,  
  LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
 
  LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PRIORITY_LOW);
 
  LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MODE_CIRCULAR);
 
  LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PERIPH_NOINCREMENT);
 
  LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MEMORY_INCREMENT);
 
  LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PDATAALIGN_HALFWORD);
 
  LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MDATAALIGN_HALFWORD);
 
...

I figured out that these commands don't do anything:

  • LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
  • LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PRIORITY_LOW);
  • LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MODE_CIRCULAR);
  • etc.

The values in the register DMA1->CCR5 all remain at 0.

Is this a bug or did I miss something?

I'm use the library STM32Cube FW_L4 V1.14.0 with a STM32L475RETx.

Best regards

3 REPLIES 3

> The values in the register DMA1->CCR5 all remain at 0.

Can you change them in the debugger? Is the DMA clock switched on in RCC?

JW

Yes, i can them change in the debugger and also when I write the values "manually" direct in the register (DMA1_CSELR->CSELR |= 1 << DMA_CSELR_C5S_Pos;).

Yes, the DMA clock is also enabled.

In the meantime, I've found out that this command works:

LL_DMA_ConfigTransfer(DMA1, LL_DMA_CHANNEL_5, LL_DMA_DIRECTION_MEMORY_TO_PERIPH |
				LL_DMA_PRIORITY_HIGH | LL_DMA_MODE_NORMAL |
				LL_DMA_PERIPH_NOINCREMENT | LL_DMA_MEMORY_INCREMENT |
				LL_DMA_PDATAALIGN_HALFWORD | LL_DMA_PDATAALIGN_HALFWORD);

Best regards

senge
Associate II

Is there already an explanation from STM why these commands do not work?