element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino IDE vs DigiSpark issue
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 8 replies
  • Subscribers 389 subscribers
  • Views 1842 views
  • Users 0 members are here
Related

Arduino IDE vs DigiSpark issue

tm_stump
tm_stump over 3 years ago

I've been looking for information about a small problem I encountered programming a Digispark board (attiny85) using the Arduino IDE and a Pololu pgm04b programmer.  The setup works without having to burn a bootloader to the digispark, but here is the issue.  If I upload the sketch using the digispark 1 or 8 Mhz board choices, the program runs as it should with no problems.  If I use one of the 16 or 16.5 MHz choices, the program runs extremely slow with maybe some other problems as the counter built in to count button pushes doesn't update.  I'm trying to find out what changes, exactly, are being made during compilation that provides a defect in the compiled program when using the higher speed choices.  I'm no expert, but I'm hoping that someone is aware of something I may be overlooking.  To throw a wrench into the works I might mention that this appears to be digispark clone so it's entirely possible that the ATtiny85 used on the board is not only not up to par but I guess there's a possibility it's not a genuine ATtiny.  I have some plain ATtiny85 on the way to try this without the digispark hardware overhead.

The sketch/program is just a simple program to count momentary button pushes, display the button push counts and allow an LED to blink on even numbered counts.

thanks,

TM

  • Sign in to reply
  • Cancel

Top Replies

  • tm_stump
    tm_stump over 3 years ago +3
    OK, I think I found the issue but I can't explain why this happens. The first and working board (digispark clone) compiled as a 16Mhz board had the Lfuse set to disable the clock divider CKDIV8 fuse, Lfuse…
  • wolfgangfriedrich
    wolfgangfriedrich over 3 years ago in reply to tm_stump +2
    Consulting the datasheet, there are 2 versions of the attiny85. The ATtiny85 which is spec'ed up to 20 MHz and the ATtiny85V which is specified only up to 10 MHz. I would be surprised that a clone would…
  • wolfgangfriedrich
    wolfgangfriedrich over 3 years ago in reply to tm_stump +1
    That is some nice debugging there. I only remember that Atmel Studio programmer had separate panels for programming fuses, EEPROM and Flash; but that was for a different chip. The Arduino IDE might not…
  • wolfgangfriedrich
    0 wolfgangfriedrich over 3 years ago

    This is just a guess and I did not read the datasheet, sometimes higher clock speed are only possible at either the high or low end of the voltage range of a chip. So it might do 16 Mhz only at 3.3 V or 5 V and your board is running on the wrong voltage. 

    Or if your text is correct and the board is running at 16 mHz, everything is running at milliHz speed. Rofl

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tm_stump
    0 tm_stump over 3 years ago in reply to wolfgangfriedrich

    Thanks for the reply.  Just a typo, should have been Mhz.  Easy enough to try a different voltage.

    (added) Just varying the voltage has no effect on the problem.  Out of 5 Digispark clones, 1 appears 'normal' and 4 appear 'not normal'.  My #1 guess is that using the Digispark 16/16.5 Mhz board definitions generates code with a problem for these board or they're just plain defective at the higher speeds.  Is it possible that there is some built-in delay to make the Digisparks work OK but get out of control with the clones?  

    TM

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • wolfgangfriedrich
    0 wolfgangfriedrich over 3 years ago in reply to tm_stump

    Consulting the datasheet, there are 2 versions of the attiny85. The ATtiny85 which is spec'ed up to 20 MHz and the ATtiny85V which is specified only up to 10 MHz. I would be surprised that a clone would use the better and more expensive chip.

    Maybe you can read the marking on the chip and see if it reads "tiny85  20xx" or tiny85V  "10xx". The datasheet is quiet about chip markings but some images of the Digispark show it quite clearly. 

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tm_stump
    0 tm_stump over 3 years ago in reply to wolfgangfriedrich

    Thanks for the reply.
    I've checked the markings and all are -20SU. I'm in the process of running through the programming of each board at different speeds to see exactly what works and what doesn't. I can dump the info on each chip/board to compare the configuration of each to see if I can spot something. So far, the working and non-working board configs look the same, fuses included. I can do a bit more but I'm at the limits of my capabilities, for now. Having read about chip counterfeiting and what happens to chips that don't pass the testing AND for what these Digispark clones cost I think I'll probably write it off as just sub-par ATtiny. I have some ATtiny85 coming from a reputable supplier to see if the same issue exists. The markings on these ICs look too light and suspicious and different from some genuine ATtiny's I have but there's really no way to tell for sure. Anyway, these boards are just some pre-testing to learn the chip for a small project so buying a few more is not a problem.  If I get ambitious enough to build an HVSP I'll try the high voltage reset just for fun.

    On a different note, there seems to be some sort of delay between posting and the post showing up, or not showing up at all, even though it appears to have gone through. ???

    Thanks,
    TM

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tm_stump
    0 tm_stump over 3 years ago

    OK, I think I found the issue but I can't explain why this happens.   The first and working board (digispark clone) compiled as a 16Mhz board had the Lfuse set to disable the clock divider CKDIV8 fuse, Lfuse:0x62 vs Lfuse:0xE2 (disabled).  The subsequent boards compiled at 16 Mhz had the Lfuse CKDIV8 enabled and so taking that board and just changing the Lfuse to disable CKDIV8, using avrdude -U lfuse:w:0xe2:m (+ the config params), the board works as expected.  This works in every case.  Now the question becomes 'why are the fuses compatible with the board choice not written in addition to the program?'  The only thing I can come up with is that I'm overlooking some setting that allows the entire sketch, including compatible fuse settings, to be written or changed.  Or maybe I found a bug when using clones with the digistump libs, but there's no feedback in searches for this type of problem so I doubt the bug factor is valid.  Back to the datasheet for a deeper dive!

    The resultant output of the incorrectly operating boards varied from very, very slow operation to giving a very slow display and an inverted display on the .96" OLED used to show the button count.  Very odd.

    thanks,

    TM

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • wolfgangfriedrich
    0 wolfgangfriedrich over 3 years ago in reply to tm_stump

    That is some nice debugging there. 

    I only remember that Atmel Studio programmer had separate panels for programming fuses, EEPROM and Flash; but that was for a different chip. The Arduino IDE might not touch anything than the Flash.

    Cheers,

     - W.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tm_stump
    0 tm_stump over 3 years ago in reply to wolfgangfriedrich

    Thanks, Wolfgang, I understand what you're saying but why did one board flash correctly and the others didn't?  I never checked the new, unused boards for fuse configurations but that's gonna be a standard thing from now on.  I may have one more of these boards that I can check.  I now wonder if these clones came with random settings and the first working board was just a lucky pick.  They came without the bootloader that is present on the real Digisparks and I did see that the genuine ATtiny chips do come from the factory with a standard configuration.  I'll check those when they get here but this may be a way to tell real from the counterfeit chips if this is actually what's going on.

    Thanks,

    TM

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Workshopshed
    0 Workshopshed over 3 years ago in reply to tm_stump

    I think the fuses get set when you choose a different menu option, something like "Burn bootloader".

    Not done every time you upload as that takes too long.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube