STM programming ADC and true DAC

True DAC or PWM dac?!

Depends of which board we have. If chip is STM32f103c8, then there is no DAC on it, but we can mimic DAC by using PWM. If board has stm32f103vet6 on the other hand, it has DAC and we can  use both channels as stereo.  Please watch video first, then it will be clear why we need move SPI pins with AFIO_MAPR function to another place – both shares the same pins.

Sorry, but last file “sample.h” is too long for this page, so it is in separate window (just select all, copy and paste into your sample.h file:  sample

2 thoughts on “STM programming ADC and true DAC”

  1. Hey Milan,
    Your project is great! I am trying to run your code for adc but I get a very weird problem. On KEIL debugger window int left and int right values are randomly constantly changing. If I try to attach a potentiometer to B0 or B1 nothing happens and they are still changing. Do you have any idea how I can fix this problem?
    I am using these files: main.c, adc.c, adc.h

    1. You should to include all other libraries, there are many, not only three. Everything is related. Each of those files should be in the same directory.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.