4 years, 3 months ago.

Problem with DAC (D12 / PA_6)

I have a problem with the third DAC (D12 / PA_6): if active simultaneously D13 and A_2 both work, but if the third active (D12 / PA6) only works this. The software is as follows /media/uploads/randow83/3dac.png

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F334R8T6 microcontroller.


posted by Andrea Valeriani 23 Nov 2015

1 Answer

3 years, 4 months ago.

I had the same problem and have now solved it after using a little bit of google translate magic on Jun's answer. The problem lies in mbed-dev (or mbed-src if you want to do it yourself) there was only one DAC handle setup but the STM32F334R8 has two DACs with three channels total. The exact file is here: targets/hal/TARGET_STM/TARGET_STM32F3/analogout_api.c

The fix was to make two handles and a make a pointer to the right handle for each function.

static DAC_HandleTypeDef DacHandle; 
static DAC_HandleTypeDef DacHandle1; 
static DAC_HandleTypeDef DacHandle2;
DAC_HandleTypeDef* DacHandle;

With a bit of jiggery pokery with & and * and -> symbols further down in the file it all works! See: https://developer.mbed.org/users/StevieWray/code/mbed-dev/ for more details. You can just import that version of mbed-dev and it should work for you.

Accepted Answer

This fix seems to have stopped working and I can't figure out why...

posted by Steven Wray 13 Jan 2017

Thank you for the reply!! Only now I've got to do more tests. Unfortunately importing your library only works PA_4 as DAC

posted by Andrea Valeriani 03 Mar 2017