Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Programming ATtiny in Visual Micro (Read 4273 times)
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Programming ATtiny in Visual Micro
Dec 10th, 2020 at 7:58pm
Print Post  
Can a ATtiny be programed with Visual Micro using Microsoft Visual studio? If so could someone please tell me how to do this. 

Thanks,

Joe
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #1 - Dec 11th, 2020 at 2:36pm
Print Post  
It certainly can be programmed using Visual Micro.

We used this chip in the Christmas Card project shown below, which has an overview of flashing the ATTiny85 via an Arduino Uno (as ISP), using Visual Micro.

See the "Coding" section, and we will update when we have a documentation page for this process:
https://create.arduino.cc/projecthub/arduinocc/christmas-card-pcb-7a13cc
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #2 - Dec 11th, 2020 at 4:01pm
Print Post  
Thank you for your quick response. So yes I can program a ATtiny with Visual Micro but I still must use the Arduino IDE to upload the bootloader. Is this correct? 

Thanks,

Joe
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #3 - Dec 11th, 2020 at 4:21pm
Print Post  
You should be able to burn the bootloader from Visual Micro in a similar way to the Arduino IDE, from the vMicro > Uploader > Burn Bootloader option.
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #4 - Dec 11th, 2020 at 4:50pm
Print Post  
Thank you again, I will give it a try.

Thanks,

Joe
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #5 - Dec 13th, 2020 at 12:31am
Print Post  
Simon:
I did give it a try. Yes, I could load the ArduinoISP, that worked fine. I also loaded a program (Sketch) into a ATtiny85 which I knew had the bootloader on it. Put ATtiny85 into breadboard and it worked fine. I could not load the bootloader with Visual Micro. I got the following error.

Burning a new bootloader
Burning bootloader to board 'ATtiny85 (ATtiny25/45/85)' using 'Arduino as ISP'
Error while burning bootloader.
Burn failed
avrdude: can't open input file aders/{bootloader.file}: No such file or directory
avrdude: read from file oaders/{bootloader.file}' failed

After trying and trying I was ready to give up, but I try something that maybe I should of not. I got a brand new ATtiny which I am sure never had the bootloader installed. I loaded a program on to it and put it in my breadboard and it worked fine. I also try a few more brand new ATtiny85, different program, different breadboards, all worked fine. Therefore I have a question. Why is the bootloader not needed? Am I missing something? What is the issue? Here is the result of one of my program compile and download, as you can see it is all fine.

Uploading 'Four_Lights_On' to 'ATtiny85 (ATtiny25/45/85)' using 'Arduino as ISP'
Uploader started for board ATtiny85 (ATtiny25/45/85)
Uploader will use programmer name: arduinoasisp
ino17\bin\avrdude rduino17/etc/avrdude.conf" -v -pattiny85 -cstk500v1 -PCOM7 -b19200 nyX5_attiny85\Release/Four_Lights_On.ino.hex:i"
avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
         System wide configuration file is uino17/etc/avrdude.conf"
         Using Port                    : COM7
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATtiny85
         Chip Erase delay              : 400000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file y85\Release/Four_Lights_On.ino.hex"
avrdude: writing flash (524 bytes):
Writing | ################################################## | 100% 0.80s
avrdude: 524 bytes of flash written
avrdude: verifying flash memory against 85\Release/Four_Lights_On.ino.hex:
avrdude: load data flash data from input file 85\Release/Four_Lights_On.ino.hex:
avrdude: input file 85\Release/Four_Lights_On.ino.hex contains 524 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.39s
avrdude: verifying ...
avrdude: 524 bytes of flash verified
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
     The upload process has finished.
avrdude done.  Thank you.

I do not understand what going on and do not like to do 
things I do not understand.

Thanks for the help,

Joe
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #6 - Dec 14th, 2020 at 10:23am
Print Post  
Thanks for the detail.

Would it be possible to set the Verbose and Show Build Properties (shown at the top of this page), and perform the build and upload again, and attach the full output as a text file?
(So we can investigate why it did not know which bootloader file to use)

For the ATTiny the bootloader burn is mainly to set the fuse bits on the chip, which can affect its clock frequency etc at runtime. I believe most ATTiny's are defaulted to 1Mhz so they will work out of the box as you say, but this may not be the desired clock frequency of your project.
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #7 - Dec 14th, 2020 at 8:12pm
Print Post  
Simon:

Here is what I believe you ask for, if I am wrong please tell me and I will respond with the correct info. Must attach a file more than 16000 Chars. Also I used a 16 MHz clock for all my ATtiny.


File attached.

Thanks,

Joe
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #8 - Dec 15th, 2020 at 5:11pm
Print Post  
Thanks for the detail, and that was exactly what we needed to review this issue.

The core detailed does not contain the bootloader.file properties, nor the bootloader.hex/bin files to flash, which explains why Visual Micro does not resolve these, leading to the error at the end.

The fuse bits are defined, and are set before the bootloader file upload, so it will update the fuse bits as expected (e.g. for 16Mhz Clock), but won't actually flash a bootloader file onto the device.
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #9 - Dec 16th, 2020 at 4:22pm
Print Post  
Simon:

The core detailed does not contain the bootloader.file properties, or the bootloader.hex/bin files to flash, which explains why Visual Micro does not resolve these, leading to the error at the end.

You are telling me that the Arduino IDE is not used doing this function and Visual Studio or Visual Micro take care of setting the fuses. Is this correct? Is it the core details of Visual Studio or Visual Micro?

The fuse bits are defined, and are set before the bootloader file upload, so it will update the fuse bits as expected (e.g. for 16Mhz Clock), but won't actually flash a bootloader file onto the device.    And I guess a bootloader file is not made.

Again either Visual Studio or Visual Micro automatically update the ATtiny with the correct setting therefore the bootloader is not needed. Is this correct?

Thanks,

Joe
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #10 - Dec 16th, 2020 at 4:54pm
Print Post  
The Core - is the board package downloaded via the Board Manager for the ATTiny chips/boards.

The Arduino IDE and Visual Micro both use settings defined within the above ATTiny core to know what to do when flashing bootloaders, compiling etc..

The bootloader is normally included in the core as a static BIN file if a bootloader is needed for e.g. Serial Upload functionality (e.g. STM32 Blue Pill)

The Fuse Bits are also set within the ATTiny core, which is how Visual Micro and Arduino IDE know what to set for the board selected.   

The Burn Bootloader Process often performs 2 actions:
1) Setting the Fuse Bits 
2) Upload the bootloader BIN File to the correct sectors on the chip

But as no bootloader is present on this chip only step 1 is successful.

Does the output differ in the Arduino IDE performing the same process?
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #11 - Dec 17th, 2020 at 1:33am
Print Post  
Simon:

Does the output differ in the Arduino IDE performing the same process?

I have no idea or answer to your question, I am not a programmer only a model railroader that use the tools.
I did program an ATtiny85 and uploaded without using the Arduino IDE bootloader and the ATtiny85 seem to be working fine. After that I did load the Arduino bootloader to see what the Verbose file would look like, maybe you can see what it is saying.

You know more than me about the two IDEs so if you say everything is fine I believe you. Attached is the Arduino verbose file.

Thanks again I think you done more than enough.

Joe
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #12 - Dec 30th, 2020 at 4:31pm
Print Post  
I did not know if I should or should not start a new link. This is still a bootloader issue.

I am still having an issue programming ATtiny85.  The ATtiny85 did not do what it was program to do after loading the program. I try three different ATtiny and all acted the same. The timing was incorrect. To make the ATtiny’s work I had to load the bootloader from the Arduino IDE. Then when I program the ATtiny’s with the Arduino IDE or with Visual Micro and they work correctly. I believe you have a bug, hope it is not me. The program I used is attached.

Regards,

Joe
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2144
Joined: Feb 13th, 2019
Re: Programming ATtiny in Visual Micro
Reply #13 - Dec 30th, 2020 at 4:44pm
Print Post  
If you try burning the bootloader from Visual Micro this should also have resolved the issues.

The timing is due to the differing clock between the chip and the expectation in the code to my understanding.

If you have another ATTiny85 which presents this issue, could you attempt the bootloader burn via vMicro, and see if this resolves the issue?

(and yes it seems confusing that it is needed, though doesn't burn a bootloader I agree, but the fuse bits are what determine the clock on-chip)
  
Back to top
 
IP Logged
 
railroadjoe
Newbies
*
Offline


Posts: 9
Joined: Dec 9th, 2020
Re: Programming ATtiny in Visual Micro
Reply #14 - Dec 30th, 2020 at 5:54pm
Print Post  
Simon:

Okay, will do.

Burning a new bootloader
Burning bootloader to board 'ATtiny85 (ATtiny25/45/85)' using 'Arduino as ISP'
Error while burning bootloader.
Burn failed
avrdude: can't open input file aders/{bootloader.file}: No such file or directory
avrdude: read from file oaders/{bootloader.file}' failed


You are correct this resolved the issue maybe it should be in the release notes, but then again I never read the release notes so it could be there.

Therefore I must burn the bootloader with Visual Micro before programming the ATtiny even thou it said it failed.

Regards,

Joe
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint