Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
js
PostPosted: May 29, 2012 - 03:37 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
And plenty of free programmers available
The Xmega chips are NOT the same as other AVR/Mega chips.
The free/cheap programmers may program the AVR range but NOT the Xmegas as they use a different programming method.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 03:42 AM
Newbie


Joined: May 26, 2012
Posts: 15


Console aps. Easy.. Smile

Quote:
Got an app you want to try?

Didnt actually understood your question. Im using AVRStudio and GCC compiler. What you mean by app?

Having first problem. I saw in many examples that pins are assigned to be digital output or input by writing DDRC=0x00 or FF. it gives me a strange error.
Quote:
Error 1 'DDRC' undeclared (first use in this function)

Port C i digital. I actually tried other ports too but getting same error
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: May 29, 2012 - 03:47 AM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21257
Location: Orlando Florida

Post the program. You need to select which AVR model number you are using. The compiler cant read your mind yet. Maybe next year.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 03:49 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Post your code.

Have you added #include <avr/io.h> so Studio knows which chip you are using? Have you set up the correct chip in the project?

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 04:01 AM
Newbie


Joined: May 26, 2012
Posts: 15


Hehe Mind reading compiler:PVery Happy You dont even have to pres to keyboard in order to write.RazzSmile
Of course i did specified the deviece. You do it when creating a new project. And yes i have <avr/io.h>

Code:
#include <avr/io.h>

int main(void)
{
 DDRQ=0xFF;

    while(1)
    {
       PORTQ=0XFF;
      
   
    }
}
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 04:06 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Which chip are you using? Which version of AVRStudio?

You say that "'DDRC' undeclared" but you are using PORTQ.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 04:11 AM
Newbie


Joined: May 26, 2012
Posts: 15


AVRStudio6
ATXmega128A1U
I also mentioned that tried with other ports. That is the code for port Q. Same Error...
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 04:29 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Try
Code:
#include <avr/io.h>

int main(void)
{
 PORTA_DIR=0xFF;

    while(1)
    {
       PORTA_OUT=0XFF;
   
    }
}
Unfortunately the version of Studio I have only supports the chip for assembly only, don't know about AS6.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 04:36 AM
Newbie


Joined: May 26, 2012
Posts: 15


Hmm strange.. And it works for me:) So i have Assembly instead of C ?

But when creating a new project i created a GCC C executable file.. how come? and i tried again to clear if mistakenly choose assembly. Same result.. DDR statement is not working for me:S
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 04:41 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

No you have C but winAvr20100110 which I use with Studio 4.18 doesn't support that chip yet.

So is it compiling now?

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 04:53 AM
Newbie


Joined: May 26, 2012
Posts: 15


it is compiling:) managed to write a simple led flasher.
Code:

#include <avr/io.h>
#include <avr/delay.h>

int main(void)
{
 PORTA_DIR=1;

    while(1)
    {
       PORTA_OUT=0;
      _delay_ms(1000);
      PORTA_OUT=1;
      _delay_ms(1000);
   
        }
return(1);
}


What should i do if codes in books are different the ones i use?
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 29, 2012 - 04:56 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18545
Location: Lund, Sweden

Quote:

Hmm strange.. [...] So i have Assembly instead of C ?

No, not strange at all.

You will actually have to open up the data sheet(s) for the AVR model you are working with to see which registers/ports it has, and what their names are.

On 8-bit (classic) AVRs there are registers registers with names like DDRx. On the 8/16-bit XMegas the digital IO-ports work differently and have other registers with other names, like PORTA_DIR. This is the difference, not if you are using assembler or C. Registers are the same in both languages.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 05:03 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
What should i do if codes in books are different the ones i use?
Choose books which are specific to the chip you are using?? Smile

Remember that Xmegas are NOT the standard AVR chip for which you may have the books for, now export that to the ARM field and you start to understand what I said before. http://www.avrfreaks.net/index.php?name ... 452#960452

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 05:23 AM
Newbie


Joined: May 26, 2012
Posts: 15


@JohanEkdahl Thanks. That was very useful info. I actually found it in datasheet.
@js Aha im feeling it now:D

Then i have 2 options:
to find a book for my chip (which would be just perfect) or to try modifying code from other books for my chip working with datasheet (which is going to be a pain in some soft part of my body:PVery Happy)
Luckily we have ASF examples. 255 ready and free examples for my chip:) that should be enough:)
 
 View user's profile Send private message  
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 08:58 PM
Newbie


Joined: May 26, 2012
Posts: 15


im getting frustrated:S cant seem to find free open source programmer for Xmega. It turns out Xmegas are using relatively new PDI for programming.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 29, 2012 - 11:22 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
cant seem to find free open source programmer for Xmega
Smile http://www.avrfreaks.net/index.php?name ... 488#960488

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Sciencefiction68
PostPosted: May 29, 2012 - 11:49 PM
Newbie


Joined: May 26, 2012
Posts: 15


I knew you are going to point that Very Happy
So what to do now? to move to ATmega? they are about 2 times more expensive than Xmega... Not cool:SSad
Or back to PIC18 Very Happy Actually it turns out PICs are cheaper Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 30, 2012 - 12:01 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20347
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

The Atmel AVR ISP Mk2 is not that expensive and you have a good tool supported by Atmel.

If you are part of a recognised learning institution you may try and get Atmel to help out, I think there is a university program.

Also you may want to look at the LUFA based programmer which you may be able to build yourself, we will need to wait on someone who has made one for further comments or wait for his excellence Dean to clarify some details. Smile

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
DocJC
PostPosted: May 30, 2012 - 04:13 AM
Raving lunatic


Joined: Dec 11, 2007
Posts: 6848
Location: Cleveland, OH

I think Larry did a successful LUFA build for a PDI programmer that supports the current (new) Xmegas.

So either Dean, (LUFA's creator), or Larry could give you some guidance in this.

JC

Edit:
Found Larry's discussion on the LUFA PDI build here
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
larryvc
PostPosted: May 30, 2012 - 04:52 AM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

This is a couple of posts above the post DocJC mentioned:

http://www.avrfreaks.net/index.php?name ... 137#960137

When it comes down to price it may be a toss up between the USBtiny and a real AVRISP mkii. I recommend one of these two for your needs.

This is what I built my AVRISP mkii clone with:

http://www.avrfreaks.net/index.php?name ... 124#957124

It is supposed to be able to do ISP, PDI, and TPI programming but I've only used it for ISP. The infrastructure for PDI and TPI is part of the LUFA code so it should work the same as a USBtiny.

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits