2023-09-29 03:09 AM
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 ?
2023-09-29 05:01 AM
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
2023-09-29 05:43 AM
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.
I still think it's an interrupt issue.
2023-09-29 09:49 PM
2023-09-29 10:04 PM
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 )
2023-09-30 06:45 AM
> 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.