AnsweredAssumed Answered

Direct register write to DAC3,2,1 in F303, F334 ,F358

Question asked by tjerneld.mikael on Oct 2, 2015
Latest reply on Oct 4, 2015 by tjerneld.mikael
I want to write directly to DAC1,2,3 as i see them, DAC1 ch1, DAC1 ch2 and DAC2 ch1
as ref manual RM0316 describes, a voltage just as simple as writing to a TIM CCR is
to output a voltage, like: TIM1->CCR1=120; so as DAC->DHR8R1=213;

Ref manual even describes a write to DAC_DHR8R1, but such address is not defined
in the stm32f30x.h file only a offset addresz. Even enable DAC1 and DAC2 is not doing
anything, PA6 ,PA5 , PA4 is just floating!

GPIOA->MODER |= GPIO_MODER_MODER6;                   //Set PA6 to Analog
GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR6;      //Set PA6 to High Speed
RCC->AHBENR |= RCC_APB1ENR_DAC1EN;                   //Enable DAC1 clock
RCC->AHBENR |= RCC_APB1ENR_DAC2EN;                   //Enable DAC2 clock
DAC->CR |= DAC_CR_EN1;                                                //Enable DAC1
DAC->CR |= DAC_CR_EN2;                                                //Enable DAC2

There is OUTEN1 and OUTEN2 register bits but the function for these is not even described
only mentioned in the register description and not defined in the 30x.h file as far as i can see
but i might have become blind by reading all those convoluted  manuals! OUTEN bits are
located on the same spot as buffer enable bits for DAC1 ch2 are these bits that makes PA6
5,4 floating? How do one turn on/off DAC3 buffer?Are there even a DAC3 buffer?

Apparently the whole DAC thing is  tripple buffered, DHR8R1->DHR1->DOR1 and the
only register one could do direct writes to is DHRyyyx, (one y to many) there is not even
a block diagram over DAC3!

Is this the right adress for DAC1 8 bit right aligned ( found in SPL)?
#define DAC_DHR8R1_ADDRESS       0x40007410

The 303 eval dac.c mentions DAC3, this is contradictionary to RM0316
303 ref manual and 334 ref manual who dont even speak about this at all!

Outcomes