2024-01-28 02:57 PM
I need to implement a system with a real and fixed sampling frequency of at least 100kHz, using a STM32F103C8T6, for two analog signals. My main question is: what is the most optimal way to implement this system considering that I also need to do processing of those signals ideally on the same board?. I have just a superficial knowledge about the use of timer triggered interrupts but I don’t know how to implement it correctly for two channels and with this high sample rate.
I would appreciate in advance if you could answer and provide me please with courses, videos, forums or documentation that could help me to implement this project.
Solved! Go to Solution.
2024-01-28 09:05 PM
Thank you very much. Do u know where should i put the CDC_Transmit line to send the data buffer by using USB as CDC? i dont know exactly if it should be on the infinite while or in some callback interrupt because it doesnt works on HAL_ADC_ConvCpltCallback function.
2024-01-28 07:13 PM
Convert ADC channels to a buffer using DMA using a timer as a trigger and process those values on the half- and full-complete interrupts. Should be CubeMX examples that use ADC with DMA.
2024-01-28 09:05 PM
Thank you very much. Do u know where should i put the CDC_Transmit line to send the data buffer by using USB as CDC? i dont know exactly if it should be on the infinite while or in some callback interrupt because it doesnt works on HAL_ADC_ConvCpltCallback function.
2024-01-29 06:20 AM
Generally it should be in the main loop. It can work in an interrupt however.
Be aware the call may fail as USB is subject to random delays. Monitor the return value.