DAC driver for STM32 *almost* done
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
DAC driver for STM32 *almost* done
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
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
- 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 STM32 *almost* done
Direct write and dual mode implemented, demo for dual mode added.
The driver needs testing, waiting for feedback
Giovanni
The driver needs testing, waiting for feedback
Giovanni
- 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 STM32 *almost* done
Hi,
There are two demos under /testhal/STM32/STM32F4xx/DAC. The driver is still experimental, not much tested.
Giovanni
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
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?
Plan:
* First test on STM32F4.
* Then test on STM32F072.
Is it expected to work on '072, or are you aware of essential differences?
- 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 STM32 *almost* done
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
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
hi, I just tried DAC test. it was awesome. great work 
can you tell me how to increase DAC frequency? Is there any documentation regarding DAC configuration? I want to generate 600KHz waveform.
Thanks,
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
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:
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;- 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 STM32 *almost* done
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
- 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 STM32 *almost* done
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