Close

USB port disappear problem and its solution

A project log for ULTRA ZERO, a successor of SDuino ZERO

This is Atmel SMART (ARM Cortex M0+) based board, a successor of SDuino Zero

kodera2tkodera2t 11/23/2016 at 11:241 Comment

I've sold more than 20 units of SAMD21G18A driven board, including ULTRA Zero, ULTRA Zero Color, and recently ULTIMA. I received a few experience of customer having "programming port recognition on OS disappear" problem. I've thought this is hardware problem (bad soldering or... related one) but it seems not hardware problem but "A phenomenon by Atmel SMART's nature", and could find the way for recovery.

I encountered this problem with this wrong programming source (please don't try to upload..

)

Yeah, internal loop function is something wrong. j=0; j<8; i++ is something wrong but it does not end just wrong program but "PROGRAMMING PORT DISAPPEARED" after uploading Arduino sketch containing this code.....!!!!

It seems, MCU becomes busy for executing wrong code and does not offer USB service and as a result no way for upload sketch again!

(REMEDY 1) Plug in USB cable to board (ULTRA Zero xx) and immediately double click reset button

This procedure prevent execute code in flash and the board will wait for new code upload.

So again Port will appear. (You may notice OLED is blank if you did some OLED related graphic program). Select newly recognised port and upload "correct (non-bug) program" through USB... Of course if same program (contains some bug or wrong point) is upload again, board will lost its connection to your computer again. Please don't do the same thing twice and re-write your program or cool-down your brain by uploading LED blink...

This procedure does not require any additional equipment. Just double click immediately after plug-in USB.

(REMEDY 2) BURNING NEW bootloader by Atmel ICE

Atmel ICE is a "must-have" item for Atmel MCU programming more deeper than Arduino environment. Just connect Atmel ICE and Ultra Zero XX board as

Please check the direction of JTAG on board. Just connect and

Select "Burn Bootloader". This is all what you will need to burn "new bootloader" to ULTRA Zero XX. After selecting and waiting around 10 secs, you will see

IF "shutdown command invoked" appears, the board is now starting with newly-burned bootloader and you will see the recognised USB port. Also in this case, "program with something wrong" uploading to board will reproduce the phenomena of "programming port lost". Please check and re-write program ..!

One optional thing to do is

change the value of "NVMCTRL_BOOTPROT" from 0x07 to 0x02. But the case is not related to this value and this modification is just optional (you don't need to do it).

Indeed, MCU board with on-board debugger such as Zero Pro by Arduino.cc can avoid this problem because in any case we can upload binary through debugger port. Also, I guess, this is why Arduino.cc release only board with debugger. (.org did release non-debugger board but )

Discussions

tony contrada wrote 12/14/2016 at 00:28 point

I tried Remedy 1 above, but still not working. It appears that just before the code uploads the device resets again and the wrong COM port is selected. I don't understand why I was able to get the microcontroller to work before and now it does not. Anyway here is the output from the Arduino IDE.

Sketch uses 35,320 bytes (13%) of program storage space. Maximum is 262,144 bytes.
Forcing reset using 1200bps open/close on port COM6
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
PORTS {COM6, } / {COM6, } => {}
Uploading using selected port: COM6
C:\Users\Tony\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM6 -U true -i -e -w -v C:\Users\Tony\AppData\Local\Temp\arduino_build_639/Clock_example.ino.bin -R
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010205
version()=v2.0 [Arduino:XYZ] May  9 2016 16:06:46
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010205
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device       : ATSAMD21G18A
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010205
Chip ID      : 10010005
version()=v2.0 [Arduino:XYZ] May  9 2016 16:06:46
Version      : v2.0 [Arduino:XYZ] May  9 2016 16:06:46
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security     : false
Boot Flash   : true
readWord(addr=0x40000834)=0x7000a
BOD          : true
readWord(addr=0x40000834)=0x7000a
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 0.827 seconds
Write 35600 bytes to flash (557 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)
[===                           ] 11% (64/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)
[======                        ] 22% (128/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000)
[==========                    ] 34% (192/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x1000)
[=============                 ] 45% (256/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x6000, size=0x1000)
[=================             ] 57% (320/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x7000, size=0x1000)
[====================          ] 68% (384/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x8000, size=0x1000)
[========================      ] 80% (448/557 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x9000, size=0x1000)
[===========================   ] 91% (512/557 pages)write(addr=0x20005000,size=0xb40)
writeBuffer(scr_addr=0x20005000, dst_addr=0xa000, size=0xb40)
[==============================] 100% (557/557 pages)
done in 0.237 seconds
Verify 35600 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = cc98
checksumBuffer(start_addr=0x3000, size=0x1000) = ea3a
checksumBuffer(start_addr=0x4000, size=0x1000) = 6efc
checksumBuffer(start_addr=0x5000, size=0x1000) = c219
checksumBuffer(start_addr=0x6000, size=0x1000) = 4fe2
checksumBuffer(start_addr=0x7000, size=0x1000) = 9bd9
checksumBuffer(start_addr=0x8000, size=0x1000) = f300
checksumBuffer(start_addr=0x9000, size=0x1000) = ba0a
checksumBuffer(start_addr=0xa000, size=0xb10) = de46
Verify successful
done in 0.028 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010205
writeWord(addr=0xe000ed0c,value=0x5fa0004)

  Are you sure? yes | no