cancel
Showing results for 
Search instead for 
Did you mean: 

when ADC DMA initialization starts ETH failed to ping

SA  V.1
Associate III

Hello team, am working ADC and Ethernet in Nucleo H745zi_q board when goes to initialize DMA for ADC  from that moment Ethernet failed to ping "destination host unreachable " . 
HAL_ADC_Init  --> HAL_ADC_MspInit -->  /* ADC3 DMA Init */   if i comment this complete function ethernet will ping.
if i enable the  hdma_adc3.Instance = BDMA_Channel0;   even a single line also ethernet fail to ping . 
am unbox the force DMA channel interrupts for ADC (because adc receive a data contineously )    how to resolve any help ?

5 REPLIES 5
Issamos
Lead II

Hello @sa V.1 

I suggest you to take a look at the errata sheet of this MCU. If there is no errata that explain this, try if this configuration is possible throw CubeMX (to make sure there is no conflict between dma and ethernet). If, there is a conflict, you should use another adc (if possible) or you have to enable DMA.

Best regards.

II

TDK
Guru

When you post multiple times, you're still reaching the same audience. If you're not getting the answer you want, perhaps improve your question. Reduce the problem down to the minimal code required to show the issue.

https://community.st.com/t5/stm32cubeide-mcus/nucleo-h745zi-q-board-cann-t-able-to-work-adc-and-ethernet/td-p/592851

https://community.st.com/t5/stm32cubeide-mcus/nucleo-h745zi-q-board-adc-issues-when-using-ethernet/td-p/590557

I still think it's an interrupt issue.

If you feel a post has answered your question, please click "Accept as Solution".

In other ADC(all1,2&3) also facing the same issue . I thought you'r done ADC and ethernet together in H745zi_q board  if you share that zip file or any procedural document that could be very helpfull .... Bellow main file is Attached 

SA  V.1
Associate III

void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(hadc->Instance==ADC3)
{
/* USER CODE BEGIN ADC3_MspInit 0 */

/* USER CODE END ADC3_MspInit 0 */

/** Initializes the peripherals clock
*/
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInitStruct.PLL2.PLL2M = 8;
PeriphClkInitStruct.PLL2.PLL2N = 60;
PeriphClkInitStruct.PLL2.PLL2P = 15;
PeriphClkInitStruct.PLL2.PLL2Q = 2;
PeriphClkInitStruct.PLL2.PLL2R = 2;
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_1;
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM;
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}

/* Peripheral clock enable */
__HAL_RCC_ADC3_CLK_ENABLE();

__HAL_RCC_GPIOF_CLK_ENABLE();
/**ADC3 GPIO Configuration
PF9 ------> ADC3_INP2
PF10 ------> ADC3_INN2
*/
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

/* ADC3 DMA Init */
/* ADC3 Init */
// hdma_adc3.Instance = BDMA_Channel0;
// hdma_adc3.Init.Request = BDMA_REQUEST_ADC3;
// hdma_adc3.Init.Direction = DMA_PERIPH_TO_MEMORY;
// hdma_adc3.Init.PeriphInc = DMA_PINC_DISABLE;
// hdma_adc3.Init.MemInc = DMA_MINC_ENABLE;
// hdma_adc3.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
// hdma_adc3.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
// hdma_adc3.Init.Mode = DMA_CIRCULAR;
// hdma_adc3.Init.Priority = DMA_PRIORITY_HIGH;
// if (HAL_DMA_Init(&hdma_adc3) != HAL_OK)
// {
// Error_Handler();
// }
//
// __HAL_LINKDMA(hadc,DMA_Handle,hdma_adc3);

/* USER CODE BEGIN ADC3_MspInit 1 */

/* USER CODE END ADC3_MspInit 1 */
}}

comment the above function eth will work in i enable the comment even a single line code eth fails to ping.

 it's an interrupt issue ?   --> How could i check and resolve this ....

bellow msp.c file and eth initialization files are attached (in he previous comment main file there ) 

TDK
Guru

it's an interrupt issue ?   --> How could i check and resolve this ....

How often are interrupts called? Specifically, the ADC DMA interrupts? If the answer is "I don't know", you can estimate it. Debug the program, hit pause, is it in the ADC DMA handler? Do that 10 or more times. Is it always in the ADC DMA handler? If so, that's probably an issue.

Commenting out HAL_DMA_Init prevents it from working, but I don't see how that gets us closer to a solution.

If you feel a post has answered your question, please click "Accept as Solution".