ADC doesn't work after code gneration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-17 8:41 AM
I’ve been working on a project for a while and initially generated the code only once at the beginning to set up the hardware configuration. Recently, I updated STM32CubeIDE from version 1.14.1 to 1.15.0. After updating, I regenerated the code without making any additional configurations, yet I noticed that ADC1 and ADC2 stopped reading data. I've double-checked the configuration and the clock settings, and they appear identical to what I had previously. I also compared the HAL files, and they seem fine. All other peripherals like SPI, UART, and I2C are functioning correctly, except for the ADC. Am I missing something here?
Solved! Go to Solution.
- Labels:
-
ADC
-
STM32CubeMX
-
STM32U5 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-22 4:14 AM
I've identified the root cause of my ADC issue related to FreeRTOS. It turns out that the ASV bit in the PWR->SVMCR register was never enabled during the initialization phase. This bit is essential for the proper operation of analog peripherals ... I suggest that this step be included in the HAL initialization code in future updates .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-17 9:18 AM
My first checks would be ADC registers for ADC clock and ADC Enable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-18 7:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-18 7:52 AM
Sure ,Project Blue.ioc is the original one i'm working with before the ADC stopped responding , Project Blue2.ioc is after the generated code , also i noticed the DRDY register of adc is never enabled for some reason , i've tried to create a new project with the updated cube ide version and worked just fine but once i enabled freertos , the adc stopped responding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 12:59 AM
I've confirmed that the clock for the ADC is enabled by checking the RCC register, but I noticed that the DRDY flag is never toggled. I compared the ADC configurations between the updated and the previous versions of the ADC drivers, and they're exactly the same. Everything worked perfectly when I started a new project with these settings. However, as soon as I introduced FreeRTOS into the mix, the ADC readings stopped functioning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 11:31 AM
Hello @Anassoumi ,
As you mentioned that the problem happened once when enabling FreeRtos, so I suggest increasing the size of the heap and stack accordingly in the .ld file.
Kind regards,
Nissrine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-22 1:42 AM
Hello, increasing the heap and stack sizes hasn't resolved the issue. I've tried starting a new project with just the ADC enabled, and it works perfectly until I activate FreeRTOS; then the ADC stops working. I've ensured that both the stack and heap are sufficiently increased in the .ld file and in the FreeRTOSConfig file. What could be causing this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-22 3:32 AM
Can someone who has access to an stm32u5 do a simple test and confirm that adc works with freertos on the latest version of cube ide ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-22 4:14 AM
I've identified the root cause of my ADC issue related to FreeRTOS. It turns out that the ASV bit in the PWR->SVMCR register was never enabled during the initialization phase. This bit is essential for the proper operation of analog peripherals ... I suggest that this step be included in the HAL initialization code in future updates .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-22 5:57 AM
Hello @Anassoumi
I confirm the issue.
The "HAL_PWREx_EnableVddA()" must be invoked in "stm32u5xx_hal_msp.c" when activating ADCx.
This issue is internally tracked with the ID: 176661, and a fix is planned for the upcoming version.
(PS: ID: 176661 is an internal tracking number and is not accessible or usable by customers)
Kind regards,
