GithubHelp home page GithubHelp logo

dimtass / stm32f407_dds_dac Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 10.94 MB

DDS generator using internal DAC on a STM32F407

Batchfile 0.01% Shell 0.01% CMake 0.09% C 97.83% Assembly 0.99% HTML 0.81% C++ 0.26%

stm32f407_dds_dac's Introduction

DDS generator using the STM32f4xxx DAC

Description

This project is a 2-channel sine signal generator using an STM32F407VET6 board. Both DAC1 and DAC2 are running in DMA mode with double buffering and FIFO enabled. The sample rate is 384KHz and for the sine generation the phase accumulator method is used. You can control the sine frequency using the stm's UART1 port. The board I've used is the following one and you can find on e-bay for about $15.

stm32f407vet6

FYI, there are two quite similar dev boards for stm32f407. The first one is the STM32F407ZET6 board and the other one is STM32F407VET6 board. Their difference is that the ZET6 micro-processor is an LQFP144 package and has 114 gpios and the VET6 is LQFP100 package with 82 GPIOs. Both have 512KB flash and 192KB ram and have exactly the same peripherals on exactly the same ports and pins; therefore the code should be compatible for both boards.

This code is part from a web article, so look for more info in this link:

http://www.stupid-projects.com/sine-generator-using-stmf407-internal-dac-and-pcm5102a/

How to compile and flash

You need cmake to build this project either on Windows or Linux. To setup the cmake properly follow the instructions from here. Then edit the cmake/TOOLCHAIN_arm_none_eabi_cortex_m3.cmake file and point TOOLCHAIN_DIR to the correct GCC path.

e.g. on Windows set(TOOLCHAIN_DIR C:/opt/gcc-arm-none-eabi-4_9-2015q3-20150921-win32) or on Linux set(TOOLCHAIN_DIR /opt/gcc-arm-none-eabi-4_9-2015q3)

Then on Windows run build.cmd or on Linux run ./build.sh and the .bin and .hex files should be created in the build-stm32/src folder. Also, a .cproject and .project files are created if you want to edit the source code.

To flash the HEX file in windows use st-link utility like this: "C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe" -c SWD -p build-stm32\src\stm32f103_wifi_usb_psu.hex -Rst

If instead the st-link you have J-Link then flash the binary/hex with J-Flash Lite gui tool.

To flash the bin in Linux: st-flash --reset write build-stm32/src/stm32f103_wifi_usb_psu.bin 0x8000000

Control commands

To change the sine frequency for each channel then connect a USB to UART converter on UART1 using the following connection: RS232 TX -> PA9 RS232 RX -> PA10 RS232 GND -> STM32 dev board GND

Then open an rs-232 terminal (e.g. Bray's Terminal) with the following settings, 115200,8,N,1 and check 'CR=LF' and '+CR' and use the following commands:

FREQ=<CH>,<FREQUENCY> This sets the desired frequncy in Hz on the selected channel.

E.g.: FREQ=1,5000 Set the DAC1 sine output frequncy to 5 KHz.

FREQ=2,18459.23 Set the DAC2 sine output frequency to 18.45923 KHz.

stm32f407_dds_dac's People

Contributors

dimtass avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.