2016-10-23 02:03 PM
Hi everybody,
when using the Standard Peripheral Library I could set DMA buffer size for I2S using something like the following: DMA_InitStructure.DMA_BufferSize = BUFFER_SIZE; But when using STM32CubeMX I could not find the equivalent. Setting buffer size is important to me because process latency depends on it. I've found in the code generated by STM32CubeMX references to DMA_SetConfig(), which in turns sets NTDR: //stm32f4xx_hal_dma.c static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) { /* Configure DMA Stream data length */ hdma->Instance->NDTR = DataLength; DMA_SetConfig() is called from HAL_DMA_Start() and HAL_DMA_Start_IT(), but none of the latter functions are called from generated code. UPDATE: I've seen an example where HAL_DMA_Start_IT() is called from user code, will try using that: HAL_DMA_Start_IT(hi2s3.hdmarx, (uint32_t)&I2SxEXT(hi2s3.Instance)->DR, (uint32_t)input_buffer, sizeof(input_buffer)/sizeof(input_buffer[0])); HAL_DMA_Start_IT(hi2s3.hdmatx, (uint32_t)&I2SxEXT(hi2s3.Instance)->DR, (uint32_t)output_buffer, sizeof(output_buffer)/sizeof(output_buffer[0])); #stm32cubemx-dma-buffer