Skip to main content
Associate
January 28, 2024
Solved

DAQ System on STM32F103 with fs 100kHz double channel

  • January 28, 2024
  • 3 replies
  • 2294 views

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.

    This topic has been closed for replies.
    Best answer by ChristianPC16

    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. 

    3 replies

    TDK
    January 29, 2024

    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.

    https://github.com/STMicroelectronics/STM32CubeF1/tree/master/Projects/STM3210E_EVAL/Examples/ADC/ADC_Sequencer

     

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    ChristianPC16AuthorBest answer
    Associate
    January 29, 2024

    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. 

    TDK
    January 29, 2024

    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.

    "If you feel a post has answered your question, please click ""Accept as Solution""."