Tell me the workaround of STM32F0x0 HAL, multi channel ADC with DMA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-10 06:07 AM
STM32CubeIDE Version: 1.9.0
Multi channel ADC with DMA cannot use on HAL library.
The HAL does not set DMA CCR prorery. MINC, PSIZE and MSIZE are not set any value, (Their all value 0).
Can I set them at application program ?
- Labels:
-
ADC
-
DMA
-
STM32CubeMX
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-16 06:42 AM
Hi @裕嗣 山田​ ,
This looks like the same issue as the one reported in Nucleo-F072RB Multi-channel ADC Problem.
@Sara BEN HADJ YAHYA​ could you please confirm if this issue is already tracked internally?
-Amel
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-24 02:17 AM
any update on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-24 05:44 AM
Now, My workaround is as follows.
Add DMA initialize routine( for example, HAL_ADCDMA_SetRegs(&hadc)) after MX_DMA_Init()
Then "STM32CubeIDE basics - 10 ADC DMA TIM HAL lab" video sample can works well.
code sample (1) (2)
By the way, I finally used ADC sequential discontinuous mode for each 1ms ADC start by (3) in sysclock interrupt service routine after HAL_ADC_Start_DMA.
----------------------------------------
(1)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC_Init();
MX_DMA_Init();
/* USER CODE BEGIN 2 */
HAL_ADCDMA_SetRegs(&hadc);
---------------------------------------
(2)
---- Somewhere in user program ------------------------------------
HAL_StatusTypeDef HAL_ADCDMA_SetRegs(ADC_HandleTypeDef *hadc)
{
uint32_t tmp = 0U;
/* Check the handle allocation */
if(NULL == hadc)
{
return HAL_ERROR;
}
if(NULL == hadc->DMA_Handle)
{
return HAL_ERROR;
}
tmp = hadc->DMA_Handle->Instance->CCR;
tmp |= ((uint32_t) ( DMA_CCR_MINC | DMA_CCR_PSIZE_0 | DMA_CCR_MSIZE_1)); /* half word peripheral and full word memory( DMA_CCR_MSIZE_1 depends on destination memory size) */
hadc->DMA_Handle->Instance->CCR = tmp;
return HAL_OK;
}
-----------------------------------------
(3) use HAL_ADC_SWTrig, if you want to trigger ADC in discontinuous mode.
HAL_StatusTypeDef HAL_ADC_SWTrig(ADC_HandleTypeDef *hadc)
{
/* Check the handle allocation */
if(NULL == hadc)
{
return HAL_ERROR;
}
hadc->Instance->CR |= ADC_CR_ADSTART;
return HAL_OK;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-24 05:48 AM
Uploaded my workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-24 06:15 AM
I do not think it is the same.