[SOLVED] Connect Arduino boards with Atmel Studio 7

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

Hello,

 

 

I do all my work with Arduino IDE, but I want to go more advanced and develop libraries with .c and .h files instead of doing all the code in one sketch with the Arduino IDE.

 

I may use Code::Blocks to do that but I'm interested in the Atmel Studio 7.

 

I've looked into "instructables" tutorial but I encountered errors with avrdude.

 

avrdude.exe: can't open config file " E:\Program": Invalid argument

avrdude.exe: error reading system wide configuration file " E:\Program"

 

My configurations I pasted in external tools are:

 

Command:

E:\Program Files Directory\Arduino\hardware\tools\avr\bin\avrdude.exe

 

Arguments:

"-C "E:\Program Files Directory\Arduino\hardware\tools\avr\etc\avrdude.conf" -p atmega328p -c arduino -P COM5 -b 115200 -U flash:w:"$(ProjectDir)Debug\$(TargetName).hex":i"

 

 

What could be the problem?

 

Regards,

Last Edited: Thu. May 18, 2017 - 10:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wolfrose wrote:
-C "E:\Program Files Directory\Arduino\hardware\tools\avr\etc\avrdude.conf"

 

Take out the "" from avrdude path.

 

-C E:\Program Files Directory\Arduino\hardware\tools\avr\etc\avrdude.conf -p atmega328p -c arduino -P COM5 -b 115200 -U flash:w:"$(ProjectDir)Debug\$(TargetName).hex":i

 

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

Still have the same error.

 

avrdude.exe: can't open config file "E:\Program": No such file or directory

avrdude.exe: error reading system wide configuration file "E:\Program"

Last Edited: Thu. May 18, 2017 - 08:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joni's advice is wrong - because the path contains spaces you must have "" around it.

 

However what version of Windows is this? In all versions of Windows I know the place where the programs are kept is either:

 

E:\Program Files\

or

E:\Program Files (x86)\

 

yet your commands say:

 

E:\Program Files Directory\

 

Since when has this contained the word "Directory" ?!?!?

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

It's pretty obvious isn't it? The path for the conf file looks highly suspect. Is it really Program Files
Directory........?

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

Yes, this is my own developed programs folder, because when I format my laptop I don't want to install the programs again, so I install them in another drive than the ordinary C:\ path.

 

Also, I don't develop

 

E:\Program Files\

or

E:\Program Files (x86)\

 

I do it in one folder assuming they all are x64 programs.

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

Yes, exactly this is my programs directory.

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

clawson wrote:
Joni's advice is wrong - because the path contains spaces you must have "" around it.

 

Ah, yes you are correct. i often prefer not to use spaces or anything special in the paths myself, since it's not once or twice i have had proplems with it in the past.

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

Any ideas?

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

Well because it stopped reading after "E:\Program" it really does look like the entire path after -C was not in quotes. Are you sure it was? 

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

Yes and I get the same error after removing the quotes.

 

I followed this tutorial and deleted the libusb0.dll files from Arduino folder.

 

http://www.visualmicro.com/post/2014/01/17/AvrIsp-MkII-Usb-Driver-for-Arduino.aspx

 

 

Then I found my developed usb serial driver, and I selected update driver and windows installed the CH340 nano driver again so Arduino IDE now detect the nano board.

 

But I want to work with AS7.

Last Edited: Thu. May 18, 2017 - 06:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So it looks like Code::Blocks may be stripping quotes. 

 

Simplest answer would seem to be to put the avrdude.conf in some directory that does not have spaces in the name then direct -C to look there instead. 

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

So, do you mean I have to install Arduino IDE in C:\ for example?

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

Sorry you mean I have to install AS7 in C:\

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

I added the quotes again and I get this output result.

 

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x75

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

No, what on earth makes you think that? I said that you need to copy ONE FILE from where it is now to a directory with a simple name then instruct avrdude to look there instead. 

 

I do like to believe this is not rocket science ;-) 

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

Your latest error is simply the usual kind of connection error. Do the usual diagnostics as given in a thousand threads before this one. 

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

Your latest error is simply the usual kind of connection error.

 You mean this error is better than the previous one, which means I'm getting near to solve this problem?

 

Do the usual diagnostics as given in a thousand threads before this one. 

 

Didn't understand what you mean by this, sorry :)

 

Do you mean I have to search more?

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

 

Which one I should put in the arguments?

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

The two locations are:

 

E:\Program Files Directory\Arduino\hardware\arduino\avr\bootloaders\gemma

 

And

 

E:\Program Files Directory\Arduino\hardware\tools\avr\etc

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

Last AS7 run:

 

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 4 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 5 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 6 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 7 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 9 of 10: not in sync: resp=0x75

avrdude.exe: stk500_recv(): programmer is not responding

avrdude.exe: stk500_getsync() attempt 10 of 10: not in sync: resp=0x75

avrdude.exe done. Thank you.

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

I get this result:

 

avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19

Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "E:\Program Files Directory\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM5

Using Programmer : arduino

Overriding Baud Rate : 57600

AVR Part : ATmega328P

Chip Erase delay : 9000 us

PAGEL : PD7

BS2 : PC2

RESET disposition : dedicated

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 20 4 0 no 1024 4 0 3600 3600 0xff 0xff

flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff

lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Arduino

Description : Arduino

Hardware Version: 2

Firmware Version: 1.16

Vtarget : 0.0 V

Varef : 0.0 V

Oscillator : Off

SCK period : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e950f (probably m328p)

avrdude.exe: safemode: hfuse reads as 0

avrdude.exe: safemode: efuse reads as 0

avrdude.exe: reading input file "C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex"

avrdude.exe: writing flash (490 bytes):

Writing | ################################################## | 100% 0.14s

avrdude.exe: 490 bytes of flash written

avrdude.exe: verifying flash memory against C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex:

avrdude.exe: load data flash data from input file C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex:

avrdude.exe: input file C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex contains 490 bytes

avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 0.11s

avrdude.exe: verifying ...

avrdude.exe: 490 bytes of flash verified

avrdude.exe: safemode: hfuse reads as 0

avrdude.exe: safemode: efuse reads as 0

avrdude.exe: safemode: Fuses OK (E:00, H:00, L:00)

avrdude.exe done. Thank you.

 

 

But the code isn't uploaded. 

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

I have another question:

 

C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex:i

Now this is my current hex file, but what if I want to upload another code? Do I have to change this parameter every time? 

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

You do know you can have multiple files and headers within the Arduino IDE?  

It does not have to be all in one file!

 

Jim

 

 

 

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

wolfrose wrote:

I have another question:

 

C:\Users\wolfrose\AppData\Local\Temp\arduino_build_89162/PORT_TESTING.ino.hex:i

Now this is my current hex file, but what if I want to upload another code? Do I have to change this parameter every time? 


No. In the setup for external tools there are meta-variables available to insert into the parameter textbox. Click the arrow to the right of it to see what is available. On the pad, not on the PC, right now so can't be more specific.

Perhaps take a look at the Studio help?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Back at the PC...

 

Here's the menu with variables I talked about:

 

Read about what the different variables are/do here: http://www.atmel.com/webdoc/GUID...

 

EDIT: Just to correct myself immediately: Atmel calls these "macros".

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Thu. May 18, 2017 - 08:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I know I can include header files developed by C configuration.

 

My next goal after connecting the nano board, is to rewrite the code in .h and .c files.

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

I don't recommend that anyone use spaces in folder/directory or file names.  Microsoft people laugh at my concern and say, "but of course you silly user, you can have spaces in filenames.  We fixed that back in version XYZ."   With MS the fixes that they do work well with the programs that they sell, and not so well on the 99.9% of the programs in general use that they don't sell.  And utility programs (regardless of how well written and supported that they are by their communities) tend to be written to be used by people who learned to program back in the 1960s and 1970s, and write code that has general conventions in their operation that date back to that era.   Things like being unable to support file names/directory names that have spaces in them.  Or inappropriate case sensitivity.  Or a thousand other stupid things.

 

 So just pretend that you are back in 1972 and rename your directory/file names with arbitrary letter combinations (like e:\PFE\ for e:\Program File Examples\) and chances are good that things will start working better.

 

When Studio WhateverNumber starts loading in the same time that it takes the Arduino IDE to load, then I will start to be convinced that it is actually as good as the Arduino IDE.  But that's never going to happen.  AVR Studio is useful when (for whatever reason) you absolutely have to work with a specific AVR part, but I believe that the concept of choosing the CPU device to meet the needs of the application is out-of-date.  Now one should chose the smallest Arduino selection that can hold your application and buy pre-made inexpensive Chinese clone boards to run the ap on.  Since, eBay only inexpensively sells a few Arduino models, this step is quite easy.  There's the Mega328p (the UNO/nano), the Mega2560 (the Mega), and the Mega32u4 (the Leonardo), and that's about it.

 

I do have old clone boards that don't have the CH340 USBserial IC on them.  They instead have worthless and expensive FTDI and Prolific ICs mounted.  For these I use a ISP programmer (USBASP) that loads a hex file generated by Arduino's SKETCH-Load Compiled Binary.  These hex files can be loaded by calling AVRdude from the command line using a batch file. 

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

Simonetta wrote:
I don't recommend that anyone use spaces in folder/directory or file names

+999999999999999999999999999999999999999999999999999999999999999999999999999 !!!

 

and not just spaces - avoid any & all "special" characters: http://www.avrfreaks.net/comment...

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

The avrdude is working, but the code doesn't upload to the chip!

 

avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19

Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "E:\Program Files Directory\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM5

Using Programmer : arduino

Overriding Baud Rate : 57600

AVR Part : ATmega328P

Chip Erase delay : 9000 us

PAGEL : PD7

BS2 : PC2

RESET disposition : dedicated

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 20 4 0 no 1024 4 0 3600 3600 0xff 0xff

flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff

lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Arduino

Description : Arduino

Hardware Version: 2

Firmware Version: 1.16

Vtarget : 0.0 V

Varef : 0.0 V

Oscillator : Off

SCK period : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e950f (probably m328p)

avrdude.exe: safemode: hfuse reads as 0

avrdude.exe: safemode: efuse reads as 0

avrdude.exe: reading input file "C:\Users\wolfrose\Documents\Atmel Studio\7.0\GccApplication1\GccApplication1\Debug\GccApplication1.hex"

avrdude.exe: writing flash (180 bytes):

Writing | ################################################## | 100% 0.07s

avrdude.exe: 180 bytes of flash written

avrdude.exe: verifying flash memory against C:\Users\wolfrose\Documents\Atmel Studio\7.0\GccApplication1\GccApplication1\Debug\GccApplication1.hex:

avrdude.exe: load data flash data from input file C:\Users\wolfrose\Documents\Atmel Studio\7.0\GccApplication1\GccApplication1\Debug\GccApplication1.hex:

avrdude.exe: input file C:\Users\wolfrose\Documents\Atmel Studio\7.0\GccApplication1\GccApplication1\Debug\GccApplication1.hex contains 180 bytes

avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 0.05s

avrdude.exe: verifying ...

avrdude.exe: 180 bytes of flash verified

avrdude.exe: safemode: hfuse reads as 0

avrdude.exe: safemode: efuse reads as 0

avrdude.exe: safemode: Fuses OK (E:00, H:00, L:00)

avrdude.exe done. Thank you.

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

 

Why this came to me? It's the first time.

 

Is it because I changed the program files name?

 

>>> to answer my question after checking, yes it's because I changed the program files directory.

Last Edited: Fri. May 19, 2017 - 07:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK it's working now :)