DAC driver for the STM32

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: DAC driver for the STM32

Post by mobyfab »

ah indeed I didn't think about that!

I might need to make some minor modifications in the driver to support that.

Right now it's very basic.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: DAC driver for the STM32

Post by Giovanni »

Great, NP, as long it works, we can grow it afterward.

Giovanni
sebx86
Posts: 14
Joined: Sat Aug 10, 2013 9:57 pm

Re: DAC driver for the STM32

Post by sebx86 »

@Mobyfab : it seemed that you forgot to call your dac_init() routine in hal.c.
I try to make that work with the STM32F4.

Sebastien
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: DAC driver for the STM32

Post by mobyfab »

I merged your code, thanks!

Fabien
sebx86
Posts: 14
Joined: Sat Aug 10, 2013 9:57 pm

Re: DAC driver for the STM32

Post by sebx86 »

Did you do some tests, is it supposed to work ?

It seems that the dac_callback_t is not implemented and missing some information about the current state of the driver, how can we know in which half of the buffer we are ?
Do you have plans for double buffering, I think it could be really useful if you wanna stream changing buffers ?

I suppose that since the DAC is not official yet, API could be still adapted...
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: DAC driver for the STM32

Post by mobyfab »

The first version was fully tested and worked pretty well.

The latest code since the API change by Giovanni has not been tested yet.

There is probably some code missing.

Double buffering was supported in the old API but not anymore.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: DAC driver for the STM32

Post by Giovanni »

The issue with double buffering is that requires the advanced DMA only found on the F4, that would make the API too platform specific.

Giovanni
sebx86
Posts: 14
Joined: Sat Aug 10, 2013 9:57 pm

Re: DAC driver for the STM32

Post by sebx86 »

Hi Mobyfab,
your code with the new API works well on the STM32F4, congrats :).

Callbacks are just missing, It seeems to miss information whether you reached the half or full buffer interrupt.
sebx86
Posts: 14
Joined: Sat Aug 10, 2013 9:57 pm

Re: DAC driver for the STM32

Post by sebx86 »

Also, in your driver, the following modifications are required
add the call to the init function in the hal main file and dac_lld_stop has to be renamed into dac_lld_stop_conversion.

It converts basically, but when you stop the conversion, the RTOS hangs. I didn't investigate that yet.
Something seems to be wrong in the high-level driver in dacStopConversion between lines 217 and 222.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: DAC driver for the STM32

Post by mobyfab »

Hey seb,

Thanks for your work, feel free to send the pull request :)

I will do some testing as soon as I can.
Post Reply