zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.83k stars 6.6k forks source link

trigger ADC sampling with hardware timer interrupt in stm32 #59326

Open Parinaz-Motus opened 1 year ago

Parinaz-Motus commented 1 year ago

Hi, how can I use hardware timer interrupt in stm32 to trigger adc sampling without dma? That is a very easy task in stm32cubeide but implementing in zephyr is not.
In adc_context.h is written for implementing this you need to use these two functions and define static void adc_context_enable_timer(struct adc_context ctx); static void adc_context_disable_timer(struct adc_context ctx); these functions in the board adc driver but that is not practical since all the set up for the adc original driver will be messed up. Any help or idea about this?

github-actions[bot] commented 1 year ago

Hi @Parinaz-Motus! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

erwango commented 1 year ago

@Parinaz-Motus Unfortunately, I'm affraid STM32 ADC driver in Zephyr is not ready to support this use case yet. One idea is to re-use directly STM32Cube API in your application code, See https://github.com/zephyrproject-rtos/hal_stm32#use-stm32cube-in-your-application