Need Help Using the ATTiny104 Xplained Nano on a Mac

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm pretty new to mcu programming so I'm looking for a little help. I just got an ATTiny104 Xplained Nano and I'm trying to do a simple blink program just to make sure that I have my toolchain setup correctly. I am using a Mac so I can'y just download Atmel Studio so I'm doing it all with avr-gcc. With the help of this forum I finally got it compiling by adding the atpack files to the avr-gcc folder but now I'm trying to flash it to the device with avrdude. I found a post (again on here) about updating the avrdude.conf file to add the attiny102/104 so I added that but I can't get it to communicate with the built in programmer. My first attempt was:

 

$avrdude -c usbasp -p attiny104 -u -U flash:w:main.hex

But that says:

avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'

So I thought that maybe it didn't have the right programmer configuration so I got the vid, pid, vendor and product and added a new entry to the avrdude.conf file that looks like this:

programmer
  id    = "xplained";
  desc  = "Xplained, http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=ATTINY104-XNANO";
  type  = "usbasp";
  connection_type = usb;
  usbvid     = 0x03EB; # ATMEL
  usbpid     = 0x2145; # Xplained built in programmer
  usbvendor  = "ATMEL";
  usbproduct = "mEDBG CMSIS-DAP";
;

Then I try again with this command:

$avrdude -c xplained -p attiny104 -u -U flash:w:main.hex

and it seems to find the device but it can't communicate with it resulting in this error:

avrdude: error: usbasp_transmit: Broken pipe
avrdude: error: usbasp_transmit: Broken pipe
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: usbasp_transmit: Broken pipe
avrdude: error: usbasp_transmit: Broken pipe
avrdude: error: program enable: target doesn't answer. 0
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: error: usbasp_transmit: Broken pipe

I've done more searching and the only thing I could find for this that looked remotely helpful was a post about setting up this board for use with the Arduino IDE but that involved using Atmel Studio to flash a new bootloader, which I can't do.

 

Am I on the right track? Has anyone gotten this working on a Mac? What am I missing?

Last Edited: Thu. Mar 15, 2018 - 02:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks!

 

Not sure if I can answer your question, don't have a Mac, but if you post a link to the avrdude.conf file I will try to figure out the avrdude stuff here using my ATTiny104 Xplained Nano.

 

EDIT: Already found the avrdude.conf info.  Thanks anyway.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Wed. Mar 14, 2018 - 07:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

CaseyB wrote:
With the help of this forum I finally got it compiling by adding the atpack files to the avr-gcc folder but now I'm trying to flash it to the device with avrdude.

 

Why do you need avrdude ? The ATTiny104 Xplained Nano  includes a Debug bridge Device, that can program and debug the tiny104 ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who-me wrote:
Why do you need avrdude ?...
I'm not a Mac user, do you know that the Debug bridge Device works with a Mac?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't use AVRdude myself, but I think you have the programmer type (-c <type>) wrong.  In a similar post, the type is xplainedmini:

./avrdude -p t416 -c xplainedmini -n -C avrdude.conf

You might want to give that a try, or even xplainednano.

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps je_ruud ​might have some insight regarding this.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First of all, you probably need to add support for ATtiny104, unless you've already done that. I haven't tested it myself, but you should only have to add this to the avrdude.conf:

#------------------------------------------------------------
# ATtiny104
#------------------------------------------------------------

part parent ".reduced_core_tiny"
    id      = "t104";
    desc    = "ATtiny104";
    signature   = 0x1e 0x92 0x21;

    memory "flash"
        size        = 1024;
        offset      = 0x4000;
        page_size   = 16;
        blocksize   = 128;
    ;
;

 

But, TPI support for the XPlained boards seems to be a bit trickier, and probably involves some additions to the Avrdude source. :-(

It shouldn't be that difficult though...

 

EDIT: typos

Last Edited: Wed. Mar 14, 2018 - 05:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for answering.

je_ruud wrote:
...First of all, you probably need to add support for ATtiny104, unless you've already done that. I haven't tested it myself, but you should only have to add this to the avrdude.conf:
That part has been completed.

 

je_ruud wrote:
But, TPI support for the XPlained boards seems to be a bit trickier, and probably involves some additions to the Avrdude source. :-(

After thorough testing last night this seems to be the case.

 

I had also added this to the avrdude.conf and tried various combinations of programmer type with no success yet, I believe this will be what is needed along with changes to the Avrdude source.  Any suggestions or changes are welcome, especially if they come from Joerg himself.

programmer
  id    = "xplainednano_tpi";
  desc  = "Atmel AVR XplainedNano in TPI mode";
  type  = "jtagice3_tpi";
  connection_type = usb;
  usbpid = 0x2145;
;

je_ruud wrote:
It shouldn't be that difficult though...

On a Linux OS no, every time I have to build avrdude from source I have to set up MingW, but that is my problem as I rarely use it, not actually complaining.  Something to do for the day.

 

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did a quick look, and it seems TPI support is missing for all Atmel/Microchip tools, so that needs to be added. When that is done there will probably be a new type called "jtagice3_tpi", but for now that is missing so it won't help adding it to avrdude.conf.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

je_ruud wrote:

I did a quick look, and it seems TPI support is missing for all Atmel/Microchip tools, so that needs to be added. When that is done there will probably be a new type called "jtagice3_tpi", but for now that is missing so it won't help adding it to avrdude.conf.

larryvc wrote:
Something to do for the day.
Change that to six months.  I think Joerg will definitely need to be involved with this task.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who-me wrote:

Why do you need avrdude ? The ATTiny104 Xplained Nano  includes a Debug bridge Device, that can program and debug the tiny104 ?

 

Like I said, I'm new to this so if there is an easier way I'm all ears!

 

Greg_Muth wrote:

I don't use AVRdude myself, but I think you have the programmer type (-c <type>) wrong.  In a similar post, the type is xplainedmini:

./avrdude -p t416 -c xplainedmini -n -C avrdude.conf

You might want to give that a try, or even xplainednano.

 

You're right! xplainedmini got me a little farther! Using this command line:

avrdude -c xplainedmini -p attiny104 -u -U flash:w:main.hex

I get a different error:

avrdude: usbdev_open(): error claiming interface 0: Permission denied
avrdude: usbdev_open(): error claiming interface 1: Permission denied
avrdude: usbdev_open(): no usable interface found
avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2145

I found, on this forum that I can tell it the exact usb device I want to use:

avrdude -c xplainedmini -p attiny104 -P usb:usbmodem1422 -u -U flash:w:main.hex

That gets rid of the permission problem but I still have that it can't find the matching vid/pid:

avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2145

This is odd because I can see it in my list of usb devices.

So that's what I'm working through right now. Thank you all for being so helpful and welcoming! I really appreciate the feedback!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

CaseyB, The programming interface to this device is TPI, and as stated by je_rudd in post #9

je_ruud wrote:

I did a quick look, and it seems TPI support is missing for all Atmel/Microchip tools, so that needs to be added. When that is done there will probably be a new type called "jtagice3_tpi", but for now that is missing so it won't help adding it to avrdude.conf.

and the dicussions that we were having before and after that post conclude with the fact that the TPI routines currently don't exist in Avrdude.

 

Simply stated, you will not be able to access the ATTiny104 Xplained Nano ​via Avrdude any time soon. 

 

I suggest that you install Parallels on your Mac, Install Windows in Parallels, then install and run AS7 on Windows.

 

​Change the main title of this thread to Need Help Using the ATTiny104 Xplained Nano on a Mac and you will probably get more help from the Mac users here.​

 

​EDIT: Clarified line about Parallels.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Thu. Mar 15, 2018 - 05:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LarryVC, that makes sense, thank you for the explanation! I have updated the title of the post as you suggested. Let's hope that helps!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

​I edited my post #12 above, line about Parallels.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Thu. Mar 15, 2018 - 05:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larryvc wrote:
... Install Windows in Parallels, ...
try before buy

virtual machines (Parallels, VirtualBox, VMware, Vagrant or Hyper-V)

Windows 7, 8.1, or 10 :

Microsoft Edge Development

Free Virtual Machines from IE8 to MS Edge

https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

Windows 10 with Visual Studio :

Microsoft

Windows app development

Download a Windows 10 virtual machine

https://developer.microsoft.com/en-us/windows/downloads/virtual-machines

 

"Dare to be naïve." - Buckminster Fuller