cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Calibration Failure on STM32N657 Using ADC1 Channel 1

dw1
Associate II

尊敬的 STMicroelectronics 支持团队:

我在 STM32N657 微控制器上遇到 ADC 校准问题。尽管进行了多次尝试,但校准过程始终失败。以下是我的设置和观察的详细信息,供您参考:

硬件配置:

  • ADC:ADC1,通道 1

  • 参考电压:

    • VREF+:外部 1.8V(测得 1.76V)

    • VREF-:接地

  • 其他:启用 ICache/DCache、GPIO、USART1 和系统隔离。

软件配置:

  • 初始化代码:

SCB_EnableICache();
SCB_EnableDCache();
HAL_Init();
MX_GPIO_Init();
MX_ADC1_Init();
MX_USART1_UART_Init();
SystemIsolation_Config();

// Debug: Check registers post-init
printf("Post-Init ADC_CR: 0x%08lX\r\n", hadc1.Instance->CR);  // Output: 0x00000000
printf("Post-Init ADC_ISR: 0x%08lX\r\n", hadc1.Instance->ISR); // Output: 0x00000000

// Explicit MSP init (debug)
HAL_ADC_MspInit(&hadc1);
printf("Post-MSP ADC_CR: 0x%08lX\r\n", hadc1.Instance->CR);    // Output: 0x00000000
printf("Post-MSP ADC_ISR: 0x%08lX\r\n", hadc1.Instance->ISR);  // Output: 0x00000000

// Attempt calibration
HAL_StatusTypeDef status = HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
if (status != HAL_OK) {
    printf("Calibration Failed. CR: 0x%08lX, ISR: 0x%08lX\n", 
           hadc1.Instance->CR, hadc1.Instance->ISR); // CR: 0x00000001, ISR: 0x0000000B
    while(1);
}

观察到的行为:

  1. 注册状态:

    • 初始化后,ADC_CR 和 ADC_ISR 保持0x00000000,表明 ADC 未启用。

    • 校准后失败:

      • ADC_CR = 0x00000001 (设置了 ADEN 位,但没有进一步的活动)。

      • ADC_ISR = 0x0000000B(标志:ADRDY + EOS + EOC)。

  2. 校准结果:

    • 总是失败并显示 HAL_ERROR。

问题:

  1. 为什么 ADC_CR 和 ADC_ISR 在初始化后保持为零?ADC 是否未正确启用?

  2. 外部参考电压(1.76V,略低于标称 1.8V)是否会导致校准失败?

  3. 是否有已知的特定于 ADC 校准STM32N657的勘误表或配置步骤?

其他上下文:

  • CubeMX 配置:

    • 单端模式、12 位分辨率、软件触发。

    • 无 DMA/IRQ,禁用扫描模式。

  • 故障排除尝试:

    • 验证 clock configuration (ADC clock ≤ max limit)。

    • 用示波器检查 VDDA/VREF+ 稳定性。

我将非常感谢任何解决此问题的见解或建议。如果需要更多详细信息,请告诉我。

最好的问候,
DW

4 REPLIES 4
Imen.D
ST Employee

Hello @dw1 ,

We advise you to post your question in English to insure a quick response for the Community.
This can also help other users to take advantage of your post, in the case they have the same question.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
dw1
Associate II

Hello Imen,
Thank you for your advice! I will make sure to post my question in English next time. I appreciate your help and will mark the solution once my question is answered.

Best regards,
dw1

Imen.D
ST Employee

Could you please share your CubeMX project or ADC configuration settings, including clock source and prescaler values, to further analyze the issue ?

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
dw1
Associate II

Hello Imen,

Thank you for your prompt response. To further assist in diagnosing the ADC calibration issue, I have attached a compressed file containing my complete STM32CubeMX project, including all configuration files and source code.

I hope these files meet your requirements for deeper analysis. Please let me know if any additional information is needed. Your expertise is greatly appreciated.

Best regards,
dw1