Page 1 of 3

DAC driver for STM32 *almost* done

Posted: Sat May 02, 2015 1:58 pm
by Giovanni
Hi,

I finally merged the DAC driver code in 3.0, the driver has been modified in order to support the dual mode (but the dual mode is not yet complete). The timer code has been removed from the driver so it is much simpler, the triggering can be done with the GPT, PWM and ICU drivers, this opens to interesting combinations.

I also plan to add a simple API to write a value on the DAC manually when the driver is in "ready" state.

Those interested could give it a try and help with debug. So far there is a demo for the F4 only.

Giovanni

Re: DAC driver for STM32 *almost* done

Posted: Sun May 03, 2015 2:14 pm
by Giovanni
Direct write and dual mode implemented, demo for dual mode added.

The driver needs testing, waiting for feedback :)

Giovanni

Re: DAC driver for STM32 *almost* done

Posted: Fri May 08, 2015 2:44 pm
by neums
Hello,
can you provide a running example project for the DAC driver?

Thanks. :-)

Re: DAC driver for STM32 *almost* done

Posted: Fri May 08, 2015 3:08 pm
by Giovanni
Hi,

There are two demos under /testhal/STM32/STM32F4xx/DAC. The driver is still experimental, not much tested.

Giovanni

Re: DAC driver for STM32 *almost* done

Posted: Fri May 22, 2015 7:05 pm
by rew
Giovanni, Great work. I'm a short on time right now, but I'm looking forward to testing this!

Plan:
* First test on STM32F4.
* Then test on STM32F072.

Is it expected to work on '072, or are you aware of essential differences?

Re: DAC driver for STM32 *almost* done

Posted: Fri May 22, 2015 8:12 pm
by Giovanni
It should work on all platforms but I tried on F3 and F4 only, let me know if there are difficulties.

It is derived by the contributed DAC driver but I decided to move the triggering outside the driver, there is no need to limit it to one timer.

Giovanni

Re: DAC driver for STM32 *almost* done

Posted: Sat May 30, 2015 4:35 pm
by erfan
hi, I just tried DAC test. it was awesome. great work :D

can you tell me how to increase DAC frequency? Is there any documentation regarding DAC configuration? I want to generate 600KHz waveform.

Thanks,

Re: DAC driver for STM32 *almost* done

Posted: Sat May 30, 2015 4:45 pm
by rew
Ran into a small bug in the main chibios stuff. Whether it's related to the problems I'm seeing I don't know yet....

http://prive.bitwizard.nl/dma_redir_patch.diff

UPDATE: DAC seems to work on stm32F072....
I'm using the direct output function:

Code: Select all

    dacPutChannelX (&DACD1, 0, t);
    t += 300;
    if (t > 0xfff) t -= 0x1000;

Re: DAC driver for STM32 *almost* done

Posted: Sat May 30, 2015 5:34 pm
by Giovanni
erfan wrote:can you tell me how to increase DAC frequency? Is there any documentation regarding DAC configuration? I want to generate 600KHz waveform.


Hi,

You have to program the GPT, the DAC is synchronized with that.

Giovanni

Re: DAC driver for STM32 *almost* done

Posted: Sat May 30, 2015 5:35 pm
by Giovanni
rew wrote:Ran into a small bug in the main chibios stuff. Whether it's related to the problems I'm seeing I don't know yet....

http://prive.bitwizard.nl/dma_redir_patch.diff

UPDATE: DAC seems to work on stm32F072....
I'm using the direct output function:

Code: Select all

    dacPutChannelX (&DACD1, 0, t);
    t += 300;
    if (t > 0xfff) t -= 0x1000;


Hi,

That bug was in the new code, thanks for the patch, committed.

Giovanni