cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 - DAC

jaykov
Associate II
Posted on August 02, 2015 at 14:00

Hi dear friends,

I have the SMT32F103RCT6 and I trying to use the DAC with DMA. I compile the ''OneChannelDMA_Escalator'' example and unfortunately it won't work, When I change the code so it will work without the DMA i can see the signal in my scope.

I attach the code that i using,

Regards, Yakov S.

#dac #gpio #dma #stm32f103
10 REPLIES 10
raptorhal2
Lead
Posted on August 02, 2015 at 15:34

Your code is not a faith full copy of the library example. The DAC tigger timer needs to be enabled after the DAC is configured.

Cheers, Hal

jaykov
Associate II
Posted on August 02, 2015 at 16:02

Dear Hal,

I edit the code so i can compare it with my other ST code that work. All the other examples and the original file is not working. I guess that is set wrong configuration to the DMA. I tried your suggestion and enabled the timer after the DMA and DAC configuration, Still it won't work.

Regards, Yakov S.

raptorhal2
Lead
Posted on August 02, 2015 at 17:04

The only other problem I see at the moment is filling the DAC right aligned register with left aligned data.

Other priorities prevail at the moment. I will have a look at this later.

Cheers, Hal

raptorhal2
Lead
Posted on August 02, 2015 at 22:23

I believe the  DAC_DHR12R1_ADDRESS   should be 0x40007408.

Cheers, Hal

jaykov
Associate II
Posted on August 03, 2015 at 14:48

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6i4&d=%2Fa%2F0X0000000btj%2FIirauUjdjBK1mMNr0x6hgpJ9DGM991vcpOUsD4yXRDM&asPdf=false
raptorhal2
Lead
Posted on August 03, 2015 at 15:22

A brief tutorial seems to be needed here.

Each DAC has a data holding register for each allowed input data alignment of 12 bit left or right and 8 bit. See Section 12.5 in the reference manual. Each register has it's address offset from the peripheral's base address.

The library example is for 8 bit data, but you used the address for the 12 bit right aligned register.

The library example has defines for low density (LD) and medium density (MD) devices and a default for all others. I believe you have a high density (HD) device. Check your defines and make sure the selected code applies to your device.

Cheers, Hal

jaykov
Associate II
Posted on August 03, 2015 at 16:55

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6i9&d=%2Fa%2F0X0000000btk%2FJJpj2Tqd7tfm6.0Bz9iGKfxNTdWa7vDLnWSQm1xbGYE&asPdf=false
raptorhal2
Lead
Posted on August 03, 2015 at 18:15

Did the previous 8 bit data code work with the correct register address ?

Cheers, Hal

jaykov
Associate II
Posted on August 04, 2015 at 08:38

Dear Hal,

It work fine without the DMA the address that I use is 0x40007410 for 8 bit data.

When I use the DMA with the same address (I check all kind of address non of them work) it won't work, I can't see on my scope the waveform.

It's seem to me that the problem is in the DMA or the timer.

Regards, Yakov S.