Can't access ABDAC on UC3-A3 Xplained Board

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello

Im working on a UC3-A3 Xplained board.
The Chip on the Board is a AT32UC3A3256-U.
I use the AVR-Studio6, completly updated. ASF is at version 3.5.1.
For debugging I use a JTAGICE-mkII

When I try to access the ABDAC Peripherials, I can't get it to work.

My tests are based on another tread here in the Forum.
https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=84160

First of all, I included the ASF-Library for the ABDAC.

Then I initialize the board:

board_init();
sysclk_init();
irq_initialize_vectors();
cpu_irq_enable();

I configured SYSCLK_SRC_OSC0.

I initialize the Pin as followed:

gpio_enable_module_pin(AVR32_ABDAC_DATA_0_0_PIN, AVR32_ABDAC_DATA_0_0_FUNCTION);

Init the DAC Samplerate:

abdac_set_dac_hz(&AVR32_ABDAC, FOSC0, 48000);

Register the Interrupt to the INTC

Disable_global_interrupt();
INTC_register_interrupt(&abdac_int_handler, AVR32_ABDAC_IRQ, AVR32_INTC_INT0);	
Enable_global_interrupt();

Activate the ABDAC Interrupt:

AVR32_ABDAC.ier = ABDAC_BIT(IER_TX_READY);

And finally activate the ABDAC:

abdac_enable(&AVR32_ABDAC);

Of course I also defined the Interrupt:

ISR(abdac_int_handler, AVR32_ABDAC_IRQ, AVR32_INTC_INT0)
{
	U16 sample;

	sample = ((U8)sound_data[i++]+0x80) << 8;
	AVR32_ABDAC.sdr = ABDAC_BF(SDR_CHANNEL0, sample) | ABDAC_BF(SDR_CHANNEL1, sample);
	if (i >= SAMPLE_COUNT) i = 0;
}

What happens:
The GPIO-Configuration seems to work.
My Scope shows, that the line is pulled down. At minimum, something happens :-)

The DAC-Samplerate is configured in the PM->gcctrl5... It seems to work. I see in the IO-View, that some flags were changed.

The Interrupt registering should be correct aswell.

And now comes the Problem:
When I ty to access any register of the ABDAC, nothing happens. I can't see any changes in the IO-View.
Neither the ABDAC-Enable nor the IER_TX_READY changes anything.

And of course, no ABDAC-Interrupt happens when I let the program run.

Other program-sections seem to work properly. As a example, the touch-slider and button work properly. (And yes, I also tried the ABDAC running without the qtouch things... doesn't works either)

Does someone know what the problem could be? I also looked for any hints, that the abdac is deactivated on my controller, like the audio codecs ,which are only active on a AT32UC3A3256-AU...
But I didn't found anything.

Thanx for any suggestions.

Martin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well... Hello again

Meanwhile I tested a lot more, and I found the small but momentous bug.
It was a small snippet from the qtouch-code-example, which turned off essential clocks, which are used by the DAC.
And without this clocks the DAC couldn't be accessed.

In a nutshell:
The codesnippets in the first post work fine!

Martin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I am playing around with the UC3A3 Xplained dev board. How did you configure your clocks for the ABDAC bitstream? Sadly there is not example code for this dev board.

Thanks, ProfChaos

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello ProfChaos

Well, generally it is absolutly easy.
You can use the functions abdac_set_dac_hz and abdac_set_dac_sample_rate. But they work not really good in my opinion. Especially because you dont really know what they do...
Therefore I programmed my Clockconfigs on my Own. And it works perfectly.

The two functions above by the way also only configure the PM registers as I do...

sysclk_enable_peripheral_clock(&AVR32_ABDAC);
pm->GCCTRL[ABDAC_GCLK].div= 6;  // div by 2*(6+1)=14
pm->GCCTRL[ABDAC_GCLK].diven=1; // Div Enable
pm->GCCTRL[ABDAC_GCLK].pllsel=1;// PLL source
pm->GCCTRL[ABDAC_GCLK].oscsel=0;// PLL 0

In my Case I overclocked my Oscillator a little bit to 72MHz.
As you can see in the Code, I use the PLL0, divide it by 14. After this, the additional BuiltIn Prescaler of 256 comes in.
72000000 / 14 / 256 = 20089.3Hz

According to the Datasheet you should run your Chip with 66MHz max. But 72MHz works fine :-)

I hope it helps a little.

Regards
Martin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its working. Needed the LP filter from the application note. Thanks Martin for your help!!