Bootloader not working

Hi.. Have a D21G with IndIO in the process of working on the guy I managed to wipe the bootloader out

and I can't seem to load it back on... Using an Atmel ICE to burn the bootloader to it in the Arduino IDE don't

work.. They connect, upload and verify corectly but when you reset the Industruino it ends up in a boot loop

the bootloader loads and the backlight starts at full brightness and begins to fade... then about halfway through the fade

it resets and starts all over again...

I've tried recompiling the bootloader to make sure the .bin file included was correct (it was) and I've tried uploading the bootloader

from within the Arduino IDE and on the command line... all leading to this reset boot loop.

G Carter-Brown
G Carter-Brown
10
| 1 1 1
Asked on 3/8/20, 8:24 PM
0
vote
2009 Views

Hi, i think it's rather unlikely you wiped off the bootloader when uploading sketches from the Arduino IDE. We have seen units becoming unresponsive due to upload procedures gone wrong, but this can always be solved by pressing the RST button on the topboard TWICE, as is standard on the Arduino M0 boards. When you do this, the bootloader is activated and the LCD fades in/out continuously, and you should see the serial port in the IDE, ready to receive an upload.

Can you try the above. If it does not work, can you confirm how you are trying the upload the bootloader, via the JTAG connector on the D21G topboard?

Tom
Tom
5675
| 1 1 3
Answered on 3/9/20, 2:03 AM
1
vote

After a bit more work I decided to tempt fate and see what would happen to my working Industruino if I used the ide to burn the bootloader... Yep, that's what kills it.. so I'm left with. If i compile the samd or samx bootloader I get a file identical to the one on the github page. Either it's something in the script for openocd that is not setting a fuse bit or something critical or the bootloader code is broken(and we know it isn't since it's been working fine until now)

G Carter-Brown
on 3/10/20, 12:52 AM

And SOLVED... the killer was bossac.. When bossac does a chip erase it overwrites the NVM User Row register (which it's not supposed to do!) and sets it to 0xFFFFFFFFFFFFFFFF which in turn causes the WDT to be enabled at boot and makes it impossable to turn off.

G Carter-Brown
on 3/11/20, 2:10 AM

https://github.com/shumatech/BOSSA/issues/99 https://github.com/arduino/ArduinoCore-samd/issues/417

G Carter-Brown
on 3/11/20, 2:13 AM

I've been fiddling with the thing all day now and I think I'm narrowing it down.

Handy thing is I have 2 D21G based Industruino's 1 working and 1 not. First things I did was to flash the bootloader

using the Arduino IDE, which connects, erases, writes and verifies fine.. and indeed I manually dumped the first 0x4000

of memory and it does indeed match the source .bin file. dumped the working one too and diffed the files.. they're identical.

It's actually been quite valuable to slowly learn how to use openocd on the command line as I can't use bossac because of

the reboot loop.  The doubletap on the reset switch leads to some of the bootloader functioning (USB VID and PID get set, Serial number does not) the fade animation starts and after about 2 seconds it resets.

Although today as I tried it(doubletap reset) I got a slow fade that ran for about 2 seconds then the backlight would turn off. openocd

shows the CPU as halted with a double fault exception and the PC was 0xFFFFFFFE..

Thats about as far as I got.. I think I've managed to eliminate flash corruption as one possible cause..

I'll continue working on this.. Any suggestions?

G Carter-Brown
G Carter-Brown
10
| 1 1 1
Answered on 3/9/20, 8:28 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

60 follower(s)

Stats

Asked: 3/8/20, 8:24 PM
Seen: 2009 times
Last updated: 3/9/20, 8:28 PM