2015-08-02 05:00 AM
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 #stm32f1032015-08-02 06:34 AM
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, Hal2015-08-02 07:02 AM
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.2015-08-02 08:04 AM
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, Hal2015-08-02 01:23 PM
I believe the DAC_DHR12R1_ADDRESS should be 0x40007408.
Cheers, Hal2015-08-03 05:48 AM
2015-08-03 06:22 AM
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, Hal2015-08-03 07:55 AM
2015-08-03 09:15 AM
Did the previous 8 bit data code work with the correct register address ?
Cheers, Hal2015-08-03 11:38 PM
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.