cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO H563ZI USART GPDMA channel6 not received buffer

togsin
Associate III

Hi~

NUCLEO H563ZI USART GPDMA channel6 not received buffer.

 

static void MX_USART6_UART_Init(void)



/* GPDMA2_REQUEST_USART6_RX Init */

NodeConfig.DestAllocatedPort = LL_DMA_DEST_ALLOCATED_PORT1;

NodeConfig.DestHWordExchange = LL_DMA_DEST_HALFWORD_PRESERVE;

NodeConfig.DestByteExchange = LL_DMA_DEST_BYTE_PRESERVE;

NodeConfig.DestBurstLength = 1;

NodeConfig.DestIncMode = LL_DMA_DEST_INCREMENT;

NodeConfig.DestDataWidth = LL_DMA_DEST_DATAWIDTH_BYTE;

NodeConfig.SrcAllocatedPort = LL_DMA_SRC_ALLOCATED_PORT0;

NodeConfig.SrcByteExchange = LL_DMA_SRC_BYTE_PRESERVE;

NodeConfig.DataAlignment = LL_DMA_DATA_ALIGN_ZEROPADD;

NodeConfig.SrcBurstLength = 1;

NodeConfig.SrcIncMode = LL_DMA_SRC_FIXED;

NodeConfig.SrcDataWidth = LL_DMA_SRC_DATAWIDTH_BYTE;

NodeConfig.TransferEventMode = LL_DMA_TCEM_LAST_LLITEM_TRANSFER;

NodeConfig.Mode = LL_DMA_NORMAL;

NodeConfig.TriggerPolarity = LL_DMA_TRIG_POLARITY_MASKED;

NodeConfig.BlkHWRequest = LL_DMA_HWREQUEST_SINGLEBURST;

NodeConfig.Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;

NodeConfig.Request = LL_GPDMA2_REQUEST_USART6_RX;

NodeConfig.BlkRptCount = 1;

NodeConfig.UpdateRegisters = (LL_DMA_UPDATE_CTR1 | LL_DMA_UPDATE_CTR2 | LL_DMA_UPDATE_CBR1 | LL_DMA_UPDATE_CSAR | LL_DMA_UPDATE_CDAR | LL_DMA_UPDATE_CTR3 | LL_DMA_UPDATE_CBR2 | LL_DMA_UPDATE_CLLR);

NodeConfig.NodeType = LL_DMA_GPDMA_LINEAR_NODE;



NodeConfig.SrcAddress = LL_USART_DMA_GetRegAddr(USART6, LL_USART_DMA_REG_DATA_RECEIVE);

NodeConfig.DestAddress = (uint32_t)usart_rx_dma_buffer;

/* Size is always in bytes! Width is determined by source and destination numbers */

NodeConfig.BlkDataLength = sizeof(usart_rx_dma_buffer);





LL_DMA_CreateLinkNode(&NodeConfig, &Node_GPDMA2_Channel6);



LL_DMA_ConnectLinkNode(&Node_GPDMA2_Channel6, LL_DMA_CLLR_OFFSET5, &Node_GPDMA2_Channel6, LL_DMA_CLLR_OFFSET5);



/* Next function call is commented because it will not compile as is. The Node structure address has to be cast to an unsigned int (uint32_t)pNode_DMAxCHy */

/*



*/

LL_DMA_SetLinkedListBaseAddr(GPDMA2, LL_DMA_CHANNEL_6, (uint32_t)&Node_GPDMA2_Channel6);

LL_DMA_ConfigLinkUpdate(GPDMA2, LL_DMA_CHANNEL_6,

(LL_DMA_UPDATE_CTR1 | LL_DMA_UPDATE_CTR2 | LL_DMA_UPDATE_CBR1 | LL_DMA_UPDATE_CSAR

| LL_DMA_UPDATE_CDAR | LL_DMA_UPDATE_CTR3 | LL_DMA_UPDATE_CBR2 | LL_DMA_UPDATE_CLLR),

(uint32_t)&Node_GPDMA2_Channel6);



DMA_InitLinkedListStruct.Priority = LL_DMA_LOW_PRIORITY_LOW_WEIGHT;

DMA_InitLinkedListStruct.LinkStepMode = LL_DMA_LSM_FULL_EXECUTION;

DMA_InitLinkedListStruct.LinkAllocatedPort = LL_DMA_LINK_ALLOCATED_PORT0;

DMA_InitLinkedListStruct.TransferEventMode = LL_DMA_TCEM_LAST_LLITEM_TRANSFER;

LL_DMA_List_Init(GPDMA2, LL_DMA_CHANNEL_6, &DMA_InitLinkedListStruct);

LL_DMA_EnableIT_HT(GPDMA2, LL_DMA_CHANNEL_6);

LL_DMA_EnableIT_TC(GPDMA2, LL_DMA_CHANNEL_6);



/* USART6 interrupt Init */

NVIC_SetPriority(USART6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),5, 0));

NVIC_EnableIRQ(USART6_IRQn);



/* USER CODE BEGIN USART6_Init 1 */

/* Configure the DMA functional parameters for transmission */



/* USER CODE END USART6_Init 1 */

USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;

USART_InitStruct.BaudRate = 115200;

USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;

USART_InitStruct.StopBits = LL_USART_STOPBITS_1;

USART_InitStruct.Parity = LL_USART_PARITY_NONE;

USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;

USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;

USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;

LL_USART_Init(USART6, &USART_InitStruct);

LL_USART_SetTXFIFOThreshold(USART6, LL_USART_FIFOTHRESHOLD_1_8);

LL_USART_SetRXFIFOThreshold(USART6, LL_USART_FIFOTHRESHOLD_1_8);

LL_USART_DisableFIFO(USART6);

LL_USART_ConfigAsyncMode(USART6);



LL_USART_EnableDMAReq_RX(USART6);

LL_USART_EnableIT_IDLE(USART6);



LL_USART_Enable(USART6);

/* USER CODE BEGIN USART6_Init 2 */

LL_DMA_EnableChannel(GPDMA2, LL_DMA_CHANNEL_6);

/* USER CODE END USART6_Init 2 */

========================================================================================

usart_rx_dma_buffer

togsin_0-1759126546367.png

 

Only one comes into the buffer and the rest is not filled

 

please check config.

 

Edit by ST Moderator to apply source code formatting.

Please see the Posting Tips for how to properly post source code.

 

6 REPLIES 6
togsin
Associate III

Hi all~

 

Additionally  when i test gpdma2 channel 0 it is working well.

Bue gpdma2 channel6 is not received buffer.

 

I  have to use gpdma channel 6 .

 

 

 

Can  you check please~

 

Thanks~

Hello,

You did accept the solution in this thread regarding the same subject but for LPUART, while this one is about USART. Could you please confirm you have solved the issue with LPUART/DMA transfer? did you intentionally accept the solution?

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.

Hi

This issue is different lpuart .

Lpuart and usart is woring well in gpdma channel 0.

 

Please do not confused.

 

Thanks.

Hello

Can you check please~

I have  not time    sorry..

 

Thanks

togsin
Associate III

Hello all

 

Can Usart use gpdma channel6(2d address) as a cycler?

 

Please reply~

Thanks.

togsin
Associate III

Hello

 

Please help me