Skip to main content
Jim Seymour
Senior
July 17, 2015
Question

Need help with simple 3-channel ADC reading

  • July 17, 2015
  • 3 replies
  • 631 views
Posted on July 17, 2015 at 18:46

I'm new to the STM32 and am trying to read three ADC channels on an F0 part.  I've used the STM32CubeMX utility to configure my hardware and then have looked over some of the ADC examples in the STM32Cube_FW_F0_V1.2.0 package.

However, I've not seen a simple example that shows how to read three channels.  I don't need fast access.  I don't need DMA.  I just need to read all three pins in a loop that's going to execute perhaps once every 100 milliseconds.

Can someone help point me to some sample code?

I tried using the ADC_DMA_Transfer example, but it seems that I only get one reading (not all three).  I must be missing something simple.

    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    July 17, 2015
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Jim Seymour
    Senior
    July 17, 2015
    Posted on July 17, 2015 at 21:26

    Thanks for the reply.  Your code is using function calls I'm not familiar with.  (eg: ADC_DMACmd()).  The code generated by STM32CubeMX use functions in the form ''HAL_ADC_*''.

    Which method is ''best''?  And where can I find the routines that you used?

    I'm developing with the Keil uVision5, if that matters.

    Tesla DeLorean
    Guru
    July 17, 2015
    Posted on July 17, 2015 at 23:02

    I use the SPL (Standard Peripheral Library), a library ST has used in similar form for their ARM parts over the last decade or so.

    http://www.st.com/web/en/catalog/tools/PF257884

    Ignore all the distractions, there is a Red Download button way down at the bottom.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..