Hi,
I am currently working on the DAC driver for the STM32F0/3/4 devices.
It's based on the patch submitted by Braun (many thanks!).
Right now it works on the F4, I will port it to the F3 and F0 in the following days/weeks.
So far I just added circular buffer support.
The code is here: https://github.com/mobyfab/ChibiOS/tree/dac
You can see the differences with the current trunk here: https://github.com/mobyfab/ChibiOS/compare/dac
The example for F4 discovery is here: https://github.com/mobyfab/ChibiOS-Exam ... DSP/main.c (video: http://www.youtube.com/watch?v=PqdnNBhFhbI)
I will make a simpler example as this one uses my DSP example using and LCD and so on.
DAC driver for the STM32
Moderator: RoccoMarco
Re: DAC driver for the STM32
Good work! I'd really love to finally see the DAC driver inside the ChibiOS/RT mainline. Maybe the other platform maintainers should be contacted to create a port since they might not read this forum (and yes, I don't know if any other, currently supported, platforms do provide a DAC).
~ Tectu
~ Tectu
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: DAC driver for the STM32
Hi,
Thanks for the work, it is really needed.
I need to specify that this will have to go post-2.6.0 or directly in 3.0.x. I need to release 2.6.0 ASAP and I am doing just fixing right now.
Giovanni
Thanks for the work, it is really needed.
I need to specify that this will have to go post-2.6.0 or directly in 3.0.x. I need to release 2.6.0 ASAP and I am doing just fixing right now.
Giovanni
Re: DAC driver for the STM32
I have updated the code with drivers and testhal demos for F0/30/37.
I had to add some code specific to the basic timers they use.
I will test them this evening on F0/F3 discovery boards, since they compile fine.
if someone has a F37x board and a scope, some testing would be helpful.
I had to add some code specific to the basic timers they use.
I will test them this evening on F0/F3 discovery boards, since they compile fine.
if someone has a F37x board and a scope, some testing would be helpful.
Re: DAC driver for the STM32
Good news, I have almost finished writing the driver 
Tested and works fine on F0 F30 and F4! (after some fixes)
Untested on F37 but very likely to work.
Video: http://www.youtube.com/watch?v=JZrWxAi_U0s
Tested and works fine on F0 F30 and F4! (after some fixes)
Untested on F37 but very likely to work.
Video: http://www.youtube.com/watch?v=JZrWxAi_U0s
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: DAC driver for the STM32
Hi,
Would be possible to keep the API as close as possible to that unfinished I2S driver? basically they do the same thing. Probably there is no need for an explicit double buffered function. It works like the ADC on reverse.
For ChibiOS 3.0 I am thinking to give a "circular" capability to the SPI driver and make it some kind of common infrastructure for SPI/I2S/DAC (not sure about ADC) and similar.
Giovanni
Would be possible to keep the API as close as possible to that unfinished I2S driver? basically they do the same thing. Probably there is no need for an explicit double buffered function. It works like the ADC on reverse.
For ChibiOS 3.0 I am thinking to give a "circular" capability to the SPI driver and make it some kind of common infrastructure for SPI/I2S/DAC (not sure about ADC) and similar.
Giovanni
Re: DAC driver for the STM32
Hi,
What I could do it use the same function names and define the DMA mode and buffers in the config structure like the I2S driver.
Does that sound good to you?
I am also moving the dac driver to the STM32 folder as it's pretty much the same for all STM32 devices.
What I could do it use the same function names and define the DMA mode and buffers in the config structure like the I2S driver.
Code: Select all
void dacInit(void);
void dacObjectInit(DACDriver *dacp);
void dacStart(DACDriver *dacp, const DACConfig *config);
void dacStop(DACDriver *dacp);
void dacStartSend(DACDriver *dacp);
void dacStopSend(DACDriver *dacp);
void dacSend(DACDriver *dacp);
Does that sound good to you?
I am also moving the dac driver to the STM32 folder as it's pretty much the same for all STM32 devices.
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: DAC driver for the STM32
That would be perfect. I would locate the files under ./STM32/DACv1 just in case it will change in some future STM32.
Giovanni
Giovanni