ATSAMR34-XPRO - Delay function freezes

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

I added to my project by ASF Wizard:
.
Delay routines (service) systick
SERCOM I2C - Master Mode I2C (driver) callback
.
When I set the break point on "nop" and run the debug, the program freezes with delay_ms(500) and didn't stop on break but sent 8 bytes sucesfully (I2C Analyzer). I don't set up callback, I am just sending 8 bytes UBX-NAV-POSLLH command (B5, 62, 01, 02, 00, 00, 03, 0A) to GPS chip.


What I am doing wrong with delay function? I am using Atmel Studio 7.0
 

int main (void)
{
    system_init();

    run_i2c_init();
    run_i2c_master_command(); // i2c_master_write_packet_wait(&i2c_master_instance, &master_packet);
    delay_ms(500);
    asm("nop");

 

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

Problem solved already. I need to use delay_init() function first to set up the clock to current chip clock.

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

Kevil wrote:
need to use delay_init() function first 

Indeed you do!

 

Please mark the solution - see Tip #5

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...