Chachka - My Trinket Clone (tiny85 powered)

Has anyone got a make file or source to compile Trinket to an ATTINY 84 by any chance ?

Cheers

koog

Quick search did not reveal anything recent enough to be indexed by Google :fearful:

https://code.google.com/p/arduino-tiny/issues/detail?id=65
seems to suggest the tiny core files will compile with the t84.

But, I have not tried this tiny.

As the t84/t85 have the same SRAM and FLASH, the bootloader should not require a significant amount of modification, if any. The core files should handle it (hoepfully.) Please report back if you try it.

Ray

Hi Ray

I am trying to compile the trinket source for an Attiny84 as it uses V-USB if I used tiny core bootloaders I would need a serial chip for use with the Arduino IDE.

I already have an Attiny84 V-USB project on a custom PCB (below)

I just thought it would be nice to have the option of an Arduino bootloader on it.

The first PCB for the project was actually for an Attiny85 but without a crystal OFC, but enumeration becomes unstable especially between different computers.

With a Attiny2313 or a 84 with a crystal it works on every pc I throw it at whether its USB1,2 or 3 port. I think Adafruit suggest not using USB3 Ports at all with the trinket and I can see why, but unfortunately on allot of modern laptops and later chip sets USB3 is the only option, so it is sometimes pot luck whether it with work or not .

I also noted on some hardware the attiny85 would not even survive a reboot without re-inserting the device.

When i compile the altered source i get an error though. :astonished:

Cheers

Koog

Very neat & professional t84 project, koogar :smiley:

I use xtal16MHz with all of my V-USB on mega328P projects and Optiboot bootloader- never had an issue from XP to Win8.1 BUT none of my many notebooks are USB3 equipped so I am unsure if an issue would exist, but I am hopeful that there would be none.

The Trinket gave (me) lots of sync errors. Adafruit is insistent to use the existing VID/PID AVRtinyISP definition used with AVRDUDE. Digispark, took a totally different route with a custom boot loader exec. and this seems stable in my limited testing. None of my t85 projects have used bootloaders, just ISP. I have built 3 prototype Trinkets (now Digispark) for bench playing. I am unsure if I would be willing to sacrifice 2K in a real project!

For Trinket & Diguspark, I have not attempted to modify the bootloaders, rather just using the provided make to build the source.
I DID note while reading through the Digispark Forum that there is a send-only driver InSide the Digispark core.

Interesting - I have not profiled this against Gammon's send only software serial, but it may be lighter weight.

Ray

Have you had a play with the Adafruit IRKey source yet Ray ?

Adafruit IRKey Adafruit IRKey with Remote - IR Remote to Keyboard : ID 1560 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits

colour me stupid, but what is the point of the trinket? essentially it just seems to be an attiny85 with a usb connector and a bootloader to make it easier to flash via the ide.

but who needs to lose memory just so they can use usb? an isp is just as easy.

also their core doesn't seem to be as good as the arduino-tiny core, as it doesn't support 3-4 pwm pins, only 2.

@sej7278

but what is the point of the trinket?

The small form-factor in a commercial product that is V-USB is the point. V-USB, for novices, can be tricky because of the component values. Also, Adafruit is producing it in 3.3V and 5.0V versions. These tiny, high quality boards, are ideal for a singularity of use. Once could easily spend more than $8 in securing quantity-one parts.

"their core doesn't seem to be as good"
Yep, agreed. But then there is the Digispark core and their libraries.

@koogar:

Have you had a play with the Adafruit IRKey source yet Ray ?

Not yet. Last weekend was the Stone Mountain Hamfest in Lawrenceville and I had been busy putting together Magic Morse units for sale. The weather was beautiful, the crowd a bit light, and folks were tight with their dollars, however I did manage to make the trip worth my while... well, I only live 2 miles away XD

I'll have a look at this IR key thingy. I have my own way of doing IR for my projects by off-loading the IR to a dedicated attiny85:
http://forum.arduino.cc/index.php?topic=139907.0

Ray

Update:
Now that Frank Zhao is an engineer with Adafruit, I think we will continue to see a proliferation of V-USB stuff. Frank is probably best know as the designer and marketer of the USnooBie:
http://eleccelerator.com/usnoobie/
which was somewhat the inspiration for my HID 14 channel 328P-PU logger:
http://www.instructables.com/id/Arduino-Digital-and-Analog-logging-using-V-USB/

(Note: Yes, RayBurne and I are the same.)

Update 2:
@Koogar:
Ok, I looked at the Adafruit IR thingy... Here is the only significant "value" that I found:

We bundle this with our remote with 21 buttons so it controls nearly anything you want.

Essentially, it is a turnkey little unit. However, I think the price is way too expensive by at least 2X... the little IR hand transmitters are available inexpensively from Hong Kong... I have 10 of them in the lab right now, but I still like the idea of using a "Sony" Universal remote because you are not painted into a corner should you step on your IR remote and crush the beast like a bug. :astonished:

So, about $5 unit 1 including shipping. I bought 10x because the shipping is free then and I had a few folks interested in a couple each... they have yet to follow through on pickup, however!

Heres the Trinket clone of my USB volume control just for kicks :slight_smile:

Cheers

Rupert

Heres the Trinket clone of my USB volume control just for kicks

@koogar:
This may be one of the coolest V-USB projects that I have ever seen... it is primo-professional. Congrats!

Ray

koogar: I spent a few days trawling through your blog last week when I was doing some research on making my Trinkets behave and might I just say some of the stuff you've done is amazing, I especially liked the crystal cmoy amp!

How much would I have to pay you for a hardware kit for the t85 Volume control? :slight_smile: I'd be interested in purchasing a case, PCB and the volume knob you used!

Cheers.

@bircoe:

How much would I have to pay you for a hardware kit for the t85 Volume control? smiley I'd be interested in purchasing a case, PCB and the volume knob you used!

Yes, I too was impressed by koogar's work. Generally, however, unless the forum topic is specifically geared to collecting interest in pre-orders, group orders, or similar issues, it is more proper to just PM the forum member. You can do a PM simply by clicking on the person's forum name and then selecting "Send this member a personal message." from the status page.

Also, the Products and Services forum is a good place to post professional services and anything-goes in Bar Sports.

By keeping the posts relevant (like, what I am not doing now) they are easier for others to reference in the future.

Ray

koogar:
Has anyone got a make file or source to compile Trinket to an ATTINY 84 by any chance ?

Cheers

koog

Yes, since yesterday evening. But not tested yet ;->
Don't know yet if it will work. I'll try later today.

Update: So far it don't work. Require further modification and the answer of the question if v-usb can be used with PCINTX instead of INT0.

OK, made that issue. USb renumeration is now working. But now I have to find how to calculate the propper Bootloader adress. Size is now 2754.

avr-size boot_hv.hex
   text    data     bss     dec     hex filename
      0     2754      0    2692     a84 boot_hv.hex
cat jump_hv.hex boot_hv.hex > flash_me_hv.hex
avr-objdump -mavr -D flash_me_hv.hex > flash_me_hv.hex.lss
avr-gcc -Wall -Os  -I. -mmcu=attiny84 -DF_CPU=16500000UL  -o boot_hv.elf usbdrv
usbdrvasm_hv.o boot_hv.o osccal_hv.o -Wl,--relax,--gc-sections -Wl,--section-st
rt=.text=1500
avr-size --format=avr --mcu=attiny84 boot_hv.elf
AVR Memory Usage
----------------
Device: attiny84

Program:    2814 bytes (34.4% Full)
(.text + .data + .bootloader)

Data:        200 bytes (39.1% Full)
(.data + .bss + .noinit)


avr-objdump -x -D -S -z boot_hv.elf > boot_hv.elf.lss
rm -f boot_hv.hex boot_hv.eep.hex
avr-objcopy -j .text -j .data -O ihex boot_hv.elf boot_hv.hex
avr-size boot_hv.hex
   text    data     bss     dec     hex filename
      0    2814       0    2814     afe boot_hv.hex
cat jump_hv.hex boot_hv.hex > flash_me_hv.hex
avr-objdump -mavr -D flash_me_hv.hex > flash_me_hv.hex.lss

Current result, output from Ardiuno. Indicate a timing issues as we have with the 85?

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0040
         0x01 != 0xff
avrdude: verification error; content mismatch

LED behave as expected, but LED on PB1 don't work
Build a breadboard trinket. load firmeware and ....
same result.

avrdude: 832 bytes of flash written
avrdude: verifying flash memory against C:\DOKUME~1\tom\LOKALE~1\Temp\build6703630600105920193.tmp\blink84.cpp.hex:
avrdude: load data flash data from input file C:\DOKUME~1\tom\LOKALE~1\Temp\build6703630600105920193.tmp\blink84.cpp.hex:
avrdude: input file C:\DOKUME~1\tom\LOKALE~1\Temp\build6703630600105920193.tmp\blink84.cpp.hex contains 832 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x20 != 0x00
avrdude: verification error; content mismatch

.....

Did I say I give up! Never, ever!

Rolf,I would never give up as instructed by Oliver Kahn.

Make the Attine85 breadboard version. It is working now.
So I'm close to make the Attiny84 working!

Thank you for the write up Ray,

Would you run make with my modified usbconfig.h on your computer and upload the resulting flash_me_lv.hex file for me please? An explanation of why I need help follows:

I've followed your guide on my linux machine and while I can upload the bootloader to the ATtiny and see it enumerate on my Mac with my own USB VID/PID pair, I'm running into a problem where the bootloader restarts continuously. Even if I don't edit the usbconfig.h file I get the same result, despite the board I made working as expected with the trinketloader.ino sketch. So I've narrowed down the source of my troubles to the linux environment I'm using to either make or upload the hex file and if you make it for me on your known-good setup it should either work or tell me that there's some problem with how I'm trying to upload the hex.

I made a trinket clone called Demiduino tiny with a purple PCB that uses all through-hole components. I focused on a low BOM cost and reproducing the shape/look of a regular Arduino board so that I can give it away to my friends to teach them how to solder and get them into electronics and Arduino. I'll post the usbconfig.h file I modified and a picture of the board too. Also if I can get this to work for my board then it'll be proof that Chachka can have it's own VID/PID pair quite easily too. Thank you for the help.

usbconfig.h (16.3 KB)

@nyukin:

NP
Attached.

Good luck,
Ray

nyukin_Adafruit-Trinket-Gemma-Bootloader-master.zip (196 KB)

logfile.txt (3.91 KB)

Hi again!

The recompiled bootloader you posted for me from your machine had the same result where the bootloader continuously restarts itself. This helped me narrow it down like I mentioned though, so thanks. I didn't think about how talking about my own trinket clone might seem a little like I was trying to hijack your Chachka thread, so I'm sorry if it came off that way.

Anyways since you helped me I wanted to return the favor. I'm happy to report after chipping away last night until 2AM and all this morning, I've finally got my trinket clone working with the Aduino IDE using my own USB VID/PID. This would be helpful if you wanted to build many more Chachkas and give them away, or if people reading your instructions want to do the same, because using your/their own VID/PID will appease the USB-IF overlords and keep Adafruit happy. However, getting to this point was not as easy as just recompiling the trinket bootloader from source with a quick change to the usbconfig.h file.

I found out that if I flashed the original bootloader, while it initially would reload the bootloader continuously, I could use avrdude from the command line to upload trinketblink.hex and then the problem I've described would go away and stay gone. Progress. However, if you change the VID/PID of the trinket clone's bootloader like I did, avrdude will no longer find a USBtinyISP programmer since it's expecting the Adafruit's specific USB/VID pair for that as well. Unfortunately, convincing avrdude to sub that pair for your own is not as easy as editing the .conf file. You need to recompile avrdude from source now as well, and in the source files you edit the usbtinyisp.h file to update your VID/PID pair there too. Take your new avrdude (I built version 6, I think the "easy" Arduino IDE Adafruit provides is based on an older version, I forget, but it worked anyways), put it in the IDE, and there you go. Obviously you have your own version of the IDE that will no longer talk to a Trinket with Adafruit's USB pair, but that's the point.

I used a lot of run-on sentences there but I hope it helps you or anyone else wanting to make themselves a Chachka, etc without incurring the wrath of the USB deities. Many thanks.

I didn't think about how talking about my own trinket clone might seem a little like I was trying to hijack your Chachka thread, so I'm sorry if it came off that way.

The thread is public... and I am happy you managed to discover the issue. I've used my VID/PID pair with the rancidbacon keyboard.h V-USB port for the 328 and had no issue, but then it was compiled under Arduino GUI... and did not invoke the V-USB in the bootloader.

Very interesting solution, the recompile of AVRDUDE. Thanks for posting the fix and for explaining what needs to be done to keep the VID-police at bay :fearful:

Ray

Hello,

I've built a Trinket Clone following Adafruit's schematic and flashed the bootloader successfully. However, the bootloader does not run when I connect the board to my computer. I don't see the USB device enumerate and the LED on PB1 does not flash.

I've checked my schematic, layout, and component values and I've looked at the pin voltages, 5V, and gnd. Nothing funny is going on. I can also talk to the Attiny85 with an ISP programmer, so the chip isn't dead. Any suggestions for what might be going on?

Also, I know this is an old thread but it seemed very relevant.

PS. I'm on Mac OS X 10.9 and I've tried the USB3 port and a USB2 hub.

The 'core' software used in the bootloader is from V-USB - A Firmware-Only USB Driver for Atmel AVR Microcontrollers
That is the logical place to start as they have a forum discussing the state of that art.

However, if you have flashed the bootloader AND set the fuses correctly, the most likely culprit is the 3.6 volt zener diodes. These simply must be low-capacitance junction devices which essentially boils down to a low wattage zener device. Not all zeners are useful even though the published specs match. I understand that hobbyists may balk at ordering directly from Newark because of the high-shipping cost, but unless you can cross-reference an exact duplicate zener from another source, your options are few. I would suggest that you and a few Arduino friends go in together to share the cost of a moderate order, > 99 units.

Part: 3.6 V 0.5W Zener
#: Vishay 1N5227B-TAP
Newark SKU: 18M3528 http://www.newark.com/vishay-semiconductor/1n5227b-tap/zener-diode-500mw-3-6v-do-35/dp/18M3528?ost=18M3528

Note added: The diodes I purchased in the past were glass and the picture at Newark.com is showing a composite; while such things should not represent an issue, my disclaimer is that I did not utilize the exact device being shown on Newark and therefore cannot guarantee success.

Hop over to Adafruit and read about it in the Trinket forum.
https://forums.adafruit.com/viewforum.php?f=52

Ray

Thank you for the response. I've tried some other non-USB test programs using an external programmer and the IC and the rest of the few components seem fine so it must be the zener diodes. Thanks for the Newark link, I've ordered a few of those and will try them out when they come in.