Go Down

Topic: MKR Fox 1200 not detected on serial port (Read 508 times) previous topic - next topic

pinko97

Apr 20, 2019, 03:12 pm Last Edit: Apr 20, 2019, 03:22 pm by pinko97
Hi everyone!
While playing with a very simple sketch (SimpleRTCAlarm), I made a very silly mistake, putting a delay call inside the interrupt function, as follows:

void alarmMatch()
{
  Serial.println(rtc.getHours());
  Serial.println(rtc.getMinutes());
  digitalWrite(LED_BUILTIN, HIGH);
  delay(200); /**** MY ERROR !!!****/
  digitalWrite(LED_BUILTIN, LOW);
}

Now the board is stuck, only the orange led is blinking slowly, it cannot connect via serial port. I've also tried to upload a "Blink" sketch via SPI from another Arduino mega board configured as "Arduino as ISP" but that doesn't work either, as IDE (Ver. 1.6.2) says that I need to pick up a different programmer:

Arduino:1.6.2 (Mac OS X), Scheda:"Arduino MKR FOX 1200"
Selezionare un programmatore dal menĂ¹ Strumenti->Programmatore

Apparently this happens with every board of MKR family, if I try to program it through ISP interface.
What should I try next?
Thank you!
Angelo

pert

Try this:
  • Press the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to get the timing of the reset just right.
  • Select the port of your board from the Tools > Port menu. The port will be different when the bootloader is running so don't assume you already have the correct port selected.
  • Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.


I've also tried to upload a "Blink" sketch via SPI from another Arduino mega board configured as "Arduino as ISP" but that doesn't work either, as IDE (Ver. 1.6.2) says that I need to pick up a different programmer:

Arduino:1.6.2 (Mac OS X), Scheda:"Arduino MKR FOX 1200"
Selezionare un programmatore dal menĂ¹ Strumenti->Programmatore

Apparently this happens with every board of MKR family, if I try to program it through ISP interface.
Yeah, I think that only works for the AVR architecture Arduino boards, and won't work with the SAMD architecture of the MKR boards. For that, you need a different type of programmer. I'm used to that ISP programmer being my "get out of jail free card" when I manage to mess up my AVR boards. I did some silly thing without thinking to my MKR Zero while trying to help someone with a problem and got it into a state where I can't upload even with the double tap trick described above and it was a bit of a shock to realize I didn't have a solution to recover it. I have one of the cheap ST-Link V2 programmer/debugger clones from eBay on the way that I'm hoping will allow me to get it up and running again.

Juraj

I did some silly thing without thinking to my MKR Zero while trying to help someone with a problem and got it into a state where I can't upload even with the double tap trick described above and it was a bit of a shock to realize I didn't have a solution to recover it. I have one of the cheap ST-Link V2 programmer/debugger clones from eBay on the way that I'm hoping will allow me to get it up and running again.
Happened to me too. But I have other SAMD board and could burn the bootloader with help of this:
https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview#

I attempted it with ST Link V2 too, but it can't do it.
later a bought a programmer/debuger LPC-Link2. I can use it as debugger with Eclipse. Stepping over code and inspecting variable values.
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

pert

Thanks Juraj. I wasn't aware of that library. Very cool! How long did it take to burn the bootloader using two SAMD boards? For me, it always sits at "Programming" for like 5 minutes and then finally errors out. I can understand the erroring out because I'm using a pogo adapter held in place by hand on the SWD pads on the target board and it's possible by the end of the 5 minutes my hand gets tired and shifts the connection on one of the pads a little, but I don't see why it would take so long to program the bootloader.

Juraj

#4
Apr 22, 2019, 12:42 pm Last Edit: Apr 22, 2019, 12:48 pm by Juraj
Thanks Juraj. I wasn't aware of that library. Very cool! How long did it take to burn the bootloader using two SAMD boards? For me, it always sits at "Programming" for like 5 minutes and then finally errors out. I can understand the erroring out because I'm using a pogo adapter held in place by hand on the SWD pads on the target board and it's possible by the end of the 5 minutes my hand gets tired and shifts the connection on one of the pads a little, but I don't see why it would take so long to program the bootloader.
the Adafruit method didn't work at first. the I added some debug prints and suddenly it was done.

to wire SWD on MKR Zero I put two pins into breadboard under the board to touch the two SWD pads. I bend away the Vcc and Vin pins (same breadboard rows as the SWD pads). Then I wired it over the breadboard and female header of the MKR.


You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

pinko97

Thanks for your suggestions. I've tried the quick double reset method and it worked. I powered the board with
a couple of AAA 1.5 cells,  and I tried the double reset. The orange led was pulsing. At that moment I connected the board to the pc and I noticed that it was showing the board on its serial port. I've uploaded the Blink sketch and it worked.
Thank you again guys!

pert

the Adafruit method didn't work at first. the I added some debug prints and suddenly it was done.
I did add a debug print in the programming loop just so I could get some indication that something was happening.

I gave it another try with a different SD card, checked all wiring for continuity, directly connected Vcc and GND, rather than having them on the less reliable pogo connection, and used a working board as the target. Result: same error and I now have two "bricked" boards. I guess I'll give up on the Adafruit DAP library and hope for better luck from the ST-Link. There is some thing from Adafruit that claims it will work as a programmer for the SAMD so maybe it will work. The first ST-Link I ordered showed up and turned out to actually be a CH340 USB to serial adapter, even though the listing description and picture clearly indicated it was an ST-Link. So now I have the long China shipping wait before I can have another try. Hopefully they at least send me the right thing now. Well, I a free USB to serial adapter for my collection as compensation. Unfortunately, it has a non-standard pinout so I'll never use it.

I put two pins into breadboard under the board to touch the two SWD pads.
And here I thought my pogo pin adapter was sketchy! Well, I can't argue with results and your system is easier on the hand too!

pert

I've tried the quick double reset method and it worked.
Great news! I'm glad to hear it's working.

Thank you again guys!
You're welcome. Enjoy!
Per

Juraj

I did add a debug print in the programming loop just so I could get some indication that something was happening.

I gave it another try with a different SD card, checked all wiring for continuity, directly connected Vcc and GND, rather than having them on the less reliable pogo connection, and used a working board as the target. Result: same error and I now have two "bricked" boards. I guess I'll give up on the Adafruit DAP library and hope for better luck from the ST-Link. There is some thing from Adafruit that claims it will work as a programmer for the SAMD so maybe it will work. The first ST-Link I ordered showed up and turned out to actually be a CH340 USB to serial adapter, even though the listing description and picture clearly indicated it was an ST-Link. So now I have the long China shipping wait before I can have another try. Hopefully they at least send me the right thing now. Well, I a free USB to serial adapter for my collection as compensation. Unfortunately, it has a non-standard pinout so I'll never use it.
And here I thought my pogo pin adapter was sketchy! Well, I can't argue with results and your system is easier on the hand too!
I don't remember the details but I think I did my usual Serial.println(10); Serial.println(20);... after almost every line of code :-)

I need to recover the MKR only once (until now). The programmer I bought, I use with M0. M0 has a SWD header and the programmer has a cable with a connector for this header.
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

Go Up