Welcome, Guest. Please login or register.

Username: Password:

Author Topic: ATMEL STUDIO 7 and Mega2560  (Read 5336 times)

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
ATMEL STUDIO 7 and Mega2560
« on: November 20, 2017, 15:12:32 »

I feel I've hijacked kaito83's thread so I've started a new one since I'm not likely to be the only person who has problems using ATMEL STUDIO.

Initial actions:

Installed ATMEL STUDIO 7 and learnt what I could from the following tutorial. https://slightlyovercomplicated.com/2015/11/13/programming-arduino-with-atmel-studio-7/.

I messed about with this and tried to manually import/add files. I was able to build the project but avrdude would not burn it.

I realised when I downloaded a new copy of AstroEQ -master that when I looked in AstroEQ-Firmware some files were now linked to ATMEL STUDIO. Great. Also that Tom has also supplied avrdude so I should be able to run the AS7 from here.

Steps so far:

Open AS7 and add an external programmer for arduino.
In the command line I used C:\.................................. \avrdude.exe pointing at the avrdude in Tom's download.
In the Arguments I used this convoluted list from the above link and pointing to Tom's avrdude.conf.
-C"C:\..................................\avrdude.conf" -patmega2560 -cwiring -P\\.\COM5 -b115200 -D -U flash:w:"$(ProjectDir)Debug\$(TargetName).hex":i

Happily this was sufficient to burn a blink sketch to the mega2560.

Opened AS7 afresh and click open project. Navigate to AstroEQ-Firmware\AstroEQ and click on AstroEQ6Mega2560.
The first time I did this there was an error and I had to reload AstroEQ6Mega2560. Subsequent times it opened fine.

Clicked on build and the following 4 warnings and 6 errors logged.

implicit declaration of function 'setPinDir' [-Wimplicit-function-declaration]   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.c   353
implicit declaration of function 'setPinValue' [-Wimplicit-function-declaration]   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.c   354
implicit declaration of function 'getPinValue' [-Wimplicit-function-declaration]   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.c   576
implicit declaration of function 'togglePin' [-Wimplicit-function-declaration]   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.c   758

'gpioPin_0_Define' undeclared here (not in a function)   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.h   157
'gpioPin_0_Define' undeclared here (not in a function)   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.h   157
'gpioPin_2_Define' undeclared here (not in a function)   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.h   157
'gpioPin_2_Define' undeclared here (not in a function)   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\AstroEQ.h   157
recipe for target 'commands.o' failed   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\ATMega2560\Makefile   107
recipe for target 'AstroEQ.o' failed   AstroEQ6Mega2560   C:\Users\Sue\Desktop\AstroEQ-master\AstroEQ-Firmware\AstroEQ\ATMega2560\Makefile   107

Gone for more coffee.  8) 8)


Logged
Phill

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #1 on: November 20, 2017, 16:48:08 »

Interesting.

Have you changed the pin assignments header file by any chance? All the errors stem back to that file having bits missing.

In terms of programming, I've already set up the custom build tool string which should be able to automatically run avrdude to program the Arduino Mega by pressing the play like button. The only think you should need to do is open the project settings for the Arduino Mega 2560, find the "Custom Programming Tool Command" string, and change the COM port number to match your port.

I'll get screenshots tonight and remind myself of exactly which button to press to upload. I forget.
Logged
Tom Carpenter (AstroEQ)

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #2 on: November 20, 2017, 16:57:05 »

Interesting.

Have you changed the pin assignments header file by any chance? All the errors stem back to that file having bits missing.

Hello Tom. YES! Changed to my pinmapping and it's even money I foolishly pasted my whole pinmapping from an earlier AstroEQ. I'll do it right this evening.

Interesting!! The words "custom build tool string" sound fabulous! I have to say that "learning" AS7 is definitely fun and worth while.

Many thanks for the fast response and help.

Kind regards

Phill
Logged
Phill

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #3 on: November 20, 2017, 17:24:31 »

Thanks Tom,

Placed the correct pinmappings in the folder and edited. Built a treat.

Couldn't find the COM in  "Custom Programming Tool Command" string so pushed the button anyway.
Output indicates programming was successfull. Looking through the log it seems either you used COM 5 or it applied it itself.

AstroEQ v 8.05 loaded config to mega without problem.

Many thanks.

Phill
« Last Edit: November 20, 2017, 17:40:19 by Phill »
Logged
Phill

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #4 on: November 20, 2017, 17:40:44 »

COM5 is what I was using. So that's quite a lucky coincidence.
Logged
Tom Carpenter (AstroEQ)

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #5 on: November 20, 2017, 22:59:30 »

If you right click on the AstroEQMega2560 project in the solution explorer and open the properties, the custom programming tool string is on the "Tool" tab.
Logged
Tom Carpenter (AstroEQ)

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #6 on: November 21, 2017, 16:03:19 »

Thanks, Tom.

Looks like I missed the little "eject" button!
Logged
Phill

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #7 on: November 25, 2017, 16:30:51 »

Hi Tom, I'm sure I am still doing something stupid here. Although ATMEL STUDIO 7 indicates that the mega programmed correctly, and the config utility runs, I do not get the expected outputs. Looks like most of the D pins are floating arouns 2 volts. I tried an LED on the step pins 4 and 11 and there is no response.

I wiped the mega and used an arduino blink sketch to manually test outputs on pin 2 - 16 and all are good.

The only other thing I can think of is that I am abusing AS7 and somehow programming AstroEQ6 rather than AstroEQMega2560. I'll give it another go and grab the output file.

Kind regards

Phill
Logged
Phill

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #8 on: November 25, 2017, 16:39:21 »

Attached Backend Build Custom Programming Tool and Build output.

To me it looks like as though I am trying to launch AstroEQ6Mega2560 but it is actually building and programming AstroEQ6 atmega162.

Phill
« Last Edit: November 25, 2017, 17:39:17 by Phill »
Logged
Phill

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #9 on: November 25, 2017, 22:39:44 »

Make sure you have the right project selected. In the "Solution Explorer" window, click on the AstroEQMega2560 project, or any of the files within it. This will tell AS7 that you want to use that specific project - you can check this by looking in the Build menu, you should see "Build AstroEQMega2560" as one of the entries. You should be able to then build and press play and have it use the correct part.

I think there is a better way of setting it up so that the part can be selected from the dropdown menu that currently says "Release", but I need to investigate that.
Logged
Tom Carpenter (AstroEQ)

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #10 on: November 25, 2017, 22:47:34 »

Figured it out.

I've just pushed a commit to the Github repository. It only changes the .atsln file to add configurations for each individual part.

You should now see in the configuration dropdown menu entries for "Release", "AstroEQ6", "AstroEQMega1280", "AstroEQMega2560" as pictured below. Select the AstroEQMega2560 option and it will ensure that the correct build and programming is done.
Logged
Tom Carpenter (AstroEQ)

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #11 on: November 26, 2017, 13:11:26 »

Using the configuration drop down returns:


Executing Custom tool:
   Command: C:\Users\Sue\Desktop\AS7 latest c\AstroEQ-master\AstroEQ-Firmware\avrdude\avrdudeStdout.bat C:\Users\Sue\Desktop\AS7 latest c\AstroEQ-master\AstroEQ-Firmware\ ATmega2560 "C:\Users\Sue\Desktop\AS7 latest c\AstroEQ-master\AstroEQ-Firmware\AstroEQ\ATMega162\AstroEQ6.hex" "\\.\COM5"
   Parsed executable: C:\Users\Sue\Desktop\AS7
   Parsed arguments: latest c\AstroEQ-master\AstroEQ-Firmware\avrdude\avrdudeStdout.bat C:\Users\Sue\Desktop\AS7 latest c\AstroEQ-master\AstroEQ-Firmware\ ATmega2560 "C:\Users\Sue\Desktop\AS7 latest c\AstroEQ-master\AstroEQ-Firmware\AstroEQ\ATMega162\AstroEQ6.hex" "\\.\COM5"


« Last Edit: November 26, 2017, 13:14:17 by Phill »
Logged
Phill

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: ATMEL STUDIO 7 and Mega2560
« Reply #12 on: November 26, 2017, 16:27:28 »

Oh, please don't put spaces in the directories. A folder called "\AS7 latest c\" has spaces so will break the scripts.

Also, it seems the configuration didn't work as planned for selecting the programming tool. I've played a bit more and the easiest way to get it to jump to the right one is to right click on the other two projects in the solution explorer and select "Unload Project" leaving only the AstroEQMega2560 project loaded. You should see something like pictured.
« Last Edit: November 26, 2017, 16:37:47 by TCWORLD »
Logged
Tom Carpenter (AstroEQ)

Phill

  • Full Member
  • ***
  • Posts: 48
    • View Profile
Re: ATMEL STUDIO 7 and Mega2560
« Reply #13 on: November 26, 2017, 19:26:43 »

Sorry about that. Unload worked fine and mega programmed without error.

I'm going out now so will try the board with the config tomorrow.

Thanks and enjoy the rest of your evening.
Logged
Phill