UC3 sample code just for the basics?

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

Hello,

I have this project using the AT32UC3A0512 for a sound codec, and need to write the firmware.  After a few years using similar chips from 'the other vendor' (yeah dsPIC), I thought the switch to AVR32 would be quick. Wrong: The ASF documentation is great for generic AVRs, though for AVR32 looks like a roundabout, with sample code plagued with macros hard to decode for AVR32 newcomers, so I'm not quite sure what I'm looking for.

So had to write the chip-independent code first, while reading the datasheet on the side and trying to digest the ASF examples.  BTW, I'm just finishing the same code on another board with a dsPIC33 for benchmark tests.

Just wondering about anyone willing to post some sample code here. Nothing too complex, just the basics to set the flash wait states, system clock, GPIO, UART, SPI and USB.

Thanks in advance!

while(!solution) {patience--;}

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

G0NZ4L0 wrote:
just the basics to set the flash wait states, system clock, GPIO, UART, SPI and USB.

Isn't that exactly what the ASF examples give you?

 

I would suggest that you get an Xplained-Pro board. When you plug that into Atmel Studio, it will present you with the complete list of Quick Start examples specifically tailored to that board - there will be examples for areas you mention...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

Isn't that exactly what the ASF examples give you?

 

Correct, but the example for the GPIO alone looked too cryptic to a beginner like my case.  I was expecting something like:

 

// Here we set the pin direction, value, then set pull-ups, pull-down, open drain or any other feature, etc.

register.bit=randomvalue; // reasons why they chose to set that value, reference to some page in datasheet, etc.

otheregister.otherbit=otherrandomvalue; // etc.

 

 

awneil wrote:

get an Xplained-Pro board

 

Sounds good, could do that. Thanks for the tip.

while(!solution) {patience--;}