New Atmel Start project and usage/examples (USART)

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

Hi All,

 

I've been looking over topics in this forum for the last hour - not finding good places to look.  I hope someone can point me in the riight direction.

 

I created a new Atmel Start project targeting the XMega128A1U.  First try doing so and found the web interface mostly well done.  Generated the project and looked through the content created -  seems like lots of useful content.  However, I cannot find appropriate documentation as to how to use all that (seemingly nice!) code.

 

For example, in the 'start interface', I added two USARTs and two TIMERS.  i can look through the usart_basic.c,h files to get a sense for the methods/functions created.  However, I can't find any example online about how to use those functions to write or read from one of the two created USARTs.  I looked at the 'EXAMPLES' folder in the folder the Start Project created - still can't figure out how to use the functions.

 

For example, the 'main' function is provided below (initially empty except for the init routine).  I realize that it's not as simple as assuming printf alone without any assignments will write to one of the two serial ports.  I attempted to set stdin = stdout = pointer to USART0 file stream.  no luck.  I'm really looking for sources of documentation so I can learn.  If anyone could point me in the right documentation correction, I'd sincerely appreciate it.

 

Peter

 

int main(void)
{
	/* Initializes MCU, drivers and middleware */
	atmel_start_init();

	/* Replace with your application code */
	while (1) 
	{
		printf("%X2",51);
	}
}

 

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

Usage documentation for Atmel Start is here: http://start.atmel.com/static/he... . This documents (if I understand it correctly) how to use Start to generate projects. It also seems to document the general structure of the code framework in the generated project(s) - see the node "Atmel Software Framework 4 (ASF4)" in the tree view.

 

Next, have a look at the node "Getting Started: Atmel START" in the tree view. Notice this

The major sources of documentation are Getting Started projects, the Atmel START User Manual, as well as reference manuals for ASF4 and AVR8 Code framework content.

[My underlining]

 

Googling for "ASF4 reference manual", I get a hit that points to this: http://ww1.microchip.com/downloa.... It has chapters for the different drivers that one can add when generating a project in Atmel Start.

 

As for tying up a standard stream to a UART, e.g. to stdout, I have no clue at the moment. Since this is re an XMega this might involve the same mechanism as for the tiny and mega AVRs as documented here: http://www.atmel.com/webdoc/AVRL... , but BEWARE that I am not even sure the Xmegas use the same runtime library (avcrlibc) as the tinys and megas, and I have no clue if ASF4/Start code plays nicely with it!

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
Since this is re an XMega this might involve the same mechanism as for the tiny and mega AVRs as documented here
It does. That is generic. Will work for any micro as long as you can simply provide the one byte uart_putchar() and uart_getchar(). It's how those are then implemented that makes them specific to some model of AVR.

 

I wouldn't have thought it was worth messing with something like "Start" for something as trivial as a UART. Just read the datasheet and implement it "raw". An Xmega UARt is not really that much more complex than a tiny/mega one. The baud rate generator stuff is a bit more complex I guess as it has "double dividers" to make some baud rates more easily reachable. Also don't forget that for Xmega the TXD/RXD pins have to have their GPIO directions set (tiny/mega do that automatically).