Atmel Start and ATSAME54-XPRO

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

Hi, my name is Livio.

I just start to work on the board ATSAME54 Xplained Pro.

I try to create a project with Atmel Start, I see on Youtube an example that use the RTC on a different board, but if I select my board 

the driver RTC isn't available, but if I look the data sheet of the processor I can found an RTC.

Some suggestions? 

Thank you

 

Livio

This topic has a solution.
Last Edited: Wed. Sep 5, 2018 - 02:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Start with an example which is supported for your board.

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

I look the examples, but I don't find an example for my board with a periodic interrupt.

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

My point is that you should spend some time with the examples that are available.

 

That way, you will gain familiarity with the tools, and the board, and the chip.

 

With that experience in hand, you should then be in a position to work out for yourself how to make a periodic interrupt. Or how to adapt an example from a different  board ...

 

In real life, you can't rely on there always being a ready-made example which exactly matches your specific requirements.

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...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The solution, for the board ATSAME54-Xplained Pro, is:

- In start.atmel.com : Add software component - timer

                                TIMER_0 : Driver: HAL:Driver:Timer

                                                Instance: TC0

                                                Prescaler: divide by 8

                                                Length of one tick in uS: 1000

 

When I save and open the project in Atmel Studio 7 I can find a file: driver_examples.c

 

/**
 * Example of using TIMER_0.
 */
static void TIMER_0_task1_cb(const struct timer_task *const timer_task)
{
	gpio_toggle_pin_level(RGB_R);
}

static void TIMER_0_task2_cb(const struct timer_task *const timer_task)
{
	gpio_toggle_pin_level(RGB_G);
}

void TIMER_0_example(void)
{
	TIMER_0_task1.interval = 100;
	TIMER_0_task1.cb       = TIMER_0_task1_cb;
	TIMER_0_task1.mode     = TIMER_TASK_REPEAT;
	
	TIMER_0_task2.interval = 500;
	TIMER_0_task2.cb       = TIMER_0_task2_cb;
	TIMER_0_task2.mode     = TIMER_TASK_REPEAT;

	timer_add_task(&TIMER_0, &TIMER_0_task1);
	timer_add_task(&TIMER_0, &TIMER_0_task2);
	timer_start(&TIMER_0);
}

and in main.c:

 


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

	gpio_set_pin_level(YELLOW_LED, true);	// led spento

	/* Replace with your application code */
	while (1) {


	}
}

 The result is: the led RGB_R toggle every 100 mS and the led RGB_G toggle every 500 mS.

 

I hope it is useful to someone else.

 

Livio