DAC digital-to-analog conversion based on Stm32cube

Source: Internet
Author: User

1. Stm32cube Configuration 1.1 DAC configuration




1.2 TIM6 Configuration
1.3 using Cube to generate engineering programs, MDK Open softwareto add a statement on the main loop:Hal_tim_base_start (&HTIM6);HAL_DAC_START_DMA (&hdac,dac_channel_2,(uint32_t *) &samples_in[0],500,dac_align_12b_r); compile complete download to core board
2. DAC Effect Verification2.1 sine table Generation
using Matlab, a sine array of 500 points is generated. Y=ceil ((2048/2-1) *sin (0:PI*2/500:2*PI) +1200); plot (y);   FID = fopen ( ' sina.txt ' , ' W ' ); fprintf (FID, '%d, ' , y); fclose (FID);2.2 Results ValidationThe sine array is entered into the MDKin the samples_in array, the oscilloscope is used to see if the sine Wave is 1KHz in duration. measured output frequency is 900Hz sine wave, analysis of the reason, is because the clock division, the same need to divide the language on the basis of 1, such as the preparation of 9, then should fill 8. Recompile, generate a sine wave with a waveform of 1KHz, as expected, as shown in.    


From for notes (Wiz)

List of attachments

    DAC digital-to-analog conversion based on Stm32cube

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.