SAMD21G18 not running after upload.

Hi.

I working on a project using an Arduino MKRWAN 1300 as reference for the design.

I can without problems upload bootloader and code to the MCU, both from Atmel Studio and Arduino IDE.
But when i upload the bootloader and reset the board, no USB presents its self.
And when i tried the blink code nothing happened on that pin.

It's like the code uploads perfectly but the MCU isnt running.

I've tried with multiple boards, and I've checked all the voltages I can think of.
Do you have any idea what causes this or maybe suggestions for thing to check or try?

Thanks a lot in advance.

Morten Lindhard Hedegaard
Comadan A/S @ Denmark

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

  • You need to post the code you are trying to run?
  • Have you tried any of the example codes in the IDE?
  • Can you write a bit of code that flashes a LED work?
  • Why did you upload the bootloader, it should already be installed?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Thanks.. Tom.. :slight_smile:

Thank you for your quick reply.

I must not have been concise enough :slight_smile:

I've designed a new PCB based on the Arduino MKR WAN 1300. So same pins used for the same stuff.
Just added my own DC/DC and some other external stuff. (but right now it has not been soldered on).

  1. Code I'm trying to run:
/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
  1. Yes I've tried the Blink Example and the Boatloader Code(And that uploads and verifies)

  2. Yes I've uploaded that but the pins stay high impedance.

  3. It's a board I've designed referencing MKR WAN 1300.

I'm a Electronics Engineer with a lot of hardware design experience. I have dabbed a bit in Arduino programming, but mostly for the smaller ones based on ATMEGAs.

Hopes this helps :slight_smile:

I fiddled with it some more.

I've opened the Arduino blink example code into Atmel Studio as a Arduino Sketch.
And then started debugging the code to see where it gets stuck.

It gets stuck in the same loop everytime in the init part.
The file is called

c:\users\morten\Documents\Atmel Studio\7.0\ArduinoSketch1\ArduinoSketch1\ArduinoCore\src\core\startup.c

It looping at the line called

while ( (GCLK->CTRL.reg & GCLK_CTRL_SWRST) && (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) )

I've included a screenshot from Atmel Studio showing the location :slight_smile:

Hi,

mortencomadan:
I've designed a new PCB based on the
. So same pins used for the same stuff.
Just added my own DC/DC and some other external stuff. (but right now it has not been soldered on).

So you have not loaded your code, or blink code, onto a WAN 1300 controller as supplied on an evaluation board?
Like this?

Tom.... :slight_smile:

Well no since I've made my own board :slight_smile:

The code works fine on the MKR WAN 1300.

But i've gone as far as loading the blink code into Atmel Studio and uploading it there.

Then it gets stuck in a loop during startup.

Figured it out. It was waiting for the 32kHz oscillator. Bad solder joint on my part.

Hi,
How were you able to load code to the WAN 1300 if the oscillator was not running?

Tom... :slight_smile: