TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: jfgomez on March 05, 2017, 11:35:16 AM

Title: Unable to upload sketch - Tiny Screen+
Post by: jfgomez on March 05, 2017, 11:35:16 AM
I have two tinyscreen+ and for one of my devices, I keep getting the following error message when trying to upload a sketch.  I'm running Windows 7 and Arduino 1.8.1.  Has anyone else seen this error?

Code: [Select]
Set binary mode
SAM-BA operation failed
readWord(addr=0)=0x200023a0
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v1.1 [Arduino:XYZ] Dec  2 2015 17:44:20
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x200023a0
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
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)=0x200023a0
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v1.1 [Arduino:XYZ] Dec  2 2015 17:44:20
Version      : v1.1 [Arduino:XYZ] Dec  2 2015 17:44:20
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
An error occurred while uploading the sketch
Title: Re: Unable to upload sketch - Tiny Screen+
Post by: Ben Rose on March 06, 2017, 03:04:00 PM
We occasionally see that with a particular computer, but not a particular board. If you haven't already, can you try holding the bootloader button down(closest to the USB connector) while turning the TinyScreen+ on, and see if you can upload then?

Thanks,
Ben
Title: Re: Unable to upload sketch - Tiny Screen+
Post by: jfgomez on March 08, 2017, 10:35:07 AM
I got it working after physically unplugging the USB cable from the computer.  It takes a couple of tries but it works now.

Thanks!
Title: Re: Unable to upload sketch - Tiny Screen+
Post by: Rick on October 08, 2019, 09:14:40 PM
On Ubuntu, I was getting the "SAM-BA operation failed" error every time I uploaded (TinyZero) and would get port unavailable type errors if I tried to upload again within about 20 seconds. Similarly, once the sketch started running, serial communication would not work (port unavailable again) for about 20 seconds.

It looks like following the instructions in the link below seems to have fixed it.
https://linux-tips.com/t/prevent-modem-manager-to-capture-usb-serial-devices/284

I think the TinyCircuits processor presents itself as a modem and the OS immediately connects to it and tries to send it some modem commands unsuccessfully which prevents the Arduino IDE from communicating with it until the OS finally gives up. Maybe something similar is happening on Windows 7 as well. Here is another link with some background info.
https://rfc1149.net/blog/2013/03/05/what-is-the-difference-between-devttyusbx-and-devttyacmx/