Skip to main content
John Lowen
Associate II
July 28, 2017
Question

Issue with changing DAC Register via ST-Link

  • July 28, 2017
  • 8 replies
  • 1654 views
Posted on July 29, 2017 at 00:27

I am having trouble changing any DAC registers using the STLINK debugger. The processor is stopped and the DAC is configured via Cube to be DAC Out 1 with output buffer enabled and no triggering. I let the code run through the Cube generated initialization code and stop at a breakpoint. Any attempt to change a register value or bit is not successful, i.e. the value does not change.

Has anyone encountered this?

#dac_out1
This topic has been closed for replies.

8 replies

Vangelis Fortounas
Associate II
July 28, 2017
Posted on July 29, 2017 at 01:18

Hello !!!

You did not mention anything about your hardware..

Anyway , in general, the initialization is not enough by itself.

try to call at your main function..

// is to set the value

HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_8B_R, 100);

// and to start the conversion

HAL_DAC_Start(&hdac, DAC_CHANNEL_1);

change parameters accordingly

Rgrds

John Lowen
Associate II
July 29, 2017
Posted on July 29, 2017 at 01:56

It shouldn't matter when it comes to changing registers by the st link

debugger. I can change other peripheral registers regardless of how the

code set them up. I just can't change the Dac registers. I am using an

stm32F764.

On Jul 28, 2017 7:19 PM, 'Vangelis Fortounas' <

Vangelis Fortounas
Associate II
July 29, 2017
Posted on July 29, 2017 at 02:47

Hello John!

probably you mean stm32f765

Check your VDDA  VREF and VSSA pins if have the proper voltages.

By your st link check at  the following register the DACEN: bit

RCC APB1 peripheral clock enable register (RCC_APB1ENR).

If is disabled, DAC is not properly initialised  (and ofcourse imposible to read or write to it)

If is enabled,  and the DAC is working normal (not by giving commands from ST LINK )  the  problem is somewhere in your IDE.

Regards

S.Ma
Principal
July 29, 2017
Posted on July 29, 2017 at 19:57

If the registers are stuck, it could be a missing clock enable. Make sure the supply to analog is present and no dma nor automatic waveform generation kicked in. Check all registers values vs reference manual to make sure its configuration is good enough. Also look at gpio rcc and sys registers.