Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Questions about going over to XMega

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Wed Jul 18, 2012 9:17 pm    Post subject: Questions about going over to XMega Reply with quote

Hi,

I am considering going from "5V Mega with FT232 USB" to XMega128A1U and wonder if somebody could help me with some general advice. Is it a big thing to reuse/convert general BASCOM code from Mega in an XMega design?

Any particular pitfalls that I should avoid?

Is it possible to use the definition file for 128A1 and do the USB stuff yourself directly on the registers?

Do I get this right? To use full-speed USB, you must set the internal 32MHz clock to 48MHz using the factory calibration data plus do custom calibration using for example an external 32.768kHz RTC clock. At 48MHz, the actual system clock must be divided by 4 to 12MHz?

I am very grateful for your input. Thanks in advance.

Kind regards

Niclas
Back to top
View user's profile
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Thu Jul 19, 2012 6:56 am    Post subject: Reply with quote

The Xmegas have many great new features, and it takes a long time to learn them.

The initial learning includes learning the new syntax for setting up I/O pins for input and output, and readng and writing to them.

Also, as the Xmegas all boot up at 2 MHz, one generally sets the clock to the desired source and speed as part of their chip initializations. The Xmegas have many clock sources available.

Note that you will need a PDI programmer. The STk500 and some of the other ISP programmers available won't work with an Xmega. There are many Threads on AVR Freaks about whether or not the Atmel Dragon can successfully program Xmegas or not. The Atmel AVR ISP mkII, at about $34 USD, is relatively inexpensive and works well for programming just about all of the AVR chips, including the Xmegas.

Note also that the Xmegas do not come in plastic dip packages. If you are use to bread boarding your designs then you need to learn a new approach. One can use an Xmega breakout board plugged into a bread board, or use an Xmega development board, (or make your own). This Thread, at AVR Freaks, has links to many Xmega development boards:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=119495&highlight=development

I can't comment on using the new USB module within the Xmega. I'm hoping that Bascom will provide a CDC (serial port), and HID USB set of instructions and an example soon!

JC
Back to top
View user's profile Visit poster's website
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Thu Jul 19, 2012 10:44 am    Post subject: Reply with quote

Thanks JC!

Kind regards

Niclas
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Thu Jul 19, 2012 12:24 pm    Post subject: Reply with quote

the setting up of ports is exact the same : config pin/port = input/output
you only have additional options with config xpin.

in the help you can read about the xmega.
i can recommend avrisp MKII too.

_________________
Mark
Back to top
View user's profile Visit poster's website
Kimmeridgien

Bascom Member



Joined: 22 Feb 2007
Posts: 89
Location: Stockholm

sweden.gif
PostPosted: Thu Jul 19, 2012 4:25 pm    Post subject: Reply with quote

Thanks Mark,

Just a quick question: The JTAGICE3 should also work with XMega? (I also have an AVRISP MkII, so no problem there.)

Kind regards

Niclas
Back to top
View user's profile
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Thu Jul 19, 2012 6:47 pm    Post subject: Reply with quote

Hi,

there is a lot of ATXMEGA documentation added in the last Bascom updates:

http://avrhelp.mcselec.com/atxmega.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/loader.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/config_adcx.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/config_portx.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/configxram.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/config_dmachx.htm?zoom_highlightsub=xmega

http://avrhelp.mcselec.com/config_xpin.htm?zoom_highlightsub=xmega

...
...



MAK3
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Fri Jul 20, 2012 4:32 am    Post subject: Reply with quote

Niclas,

your question about programming Xmega with JTAGICE3 - should work - because it includes PDI programming capability.

From Atmel

Quote:
JTAGICE3 Key Features
•Supports JTAG, aWire, SPI and PDI interfaces
•3 hardware program breakpoints and 1 maskable data breakpoint (depending on the OCD module on the AV
•Symbolic debug of complex data types including scope information
•Up to 128 software breakpoints
•1.8V to 5.5V target operation
•Uploads 256KB code in ~14 seconds (XMEGA using JTAG interface)
•USB powered
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Jul 20, 2012 9:29 am    Post subject: Reply with quote

the new jtagice is not supported by bascom. i do not have one to test to see what the problem is about. but it is of course supported by studio.
_________________
Mark
Back to top
View user's profile Visit poster's website
Kimmeridgien

Bascom Member



Joined: 22 Feb 2007
Posts: 89
Location: Stockholm

sweden.gif
PostPosted: Fri Jul 20, 2012 11:08 am    Post subject: Reply with quote

Thanks!
Back to top
View user's profile
mlcarter

Bascom Member



Joined: 12 May 2009
Posts: 11

newzealand.gif
PostPosted: Sun Aug 26, 2012 10:37 pm    Post subject: dumby question Reply with quote

I'm just looking at using an ATxmega for the faster 12 bit A-Ds. I see it has to be programmed using the PDI interface
The question I have Re programming with an AVRISP MKII.
Is this achieved by hooking it onto the PDI pins somehow.?
Is it then possible to set fuses etc from Bascom?
Back to top
View user's profile
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Wed Aug 29, 2012 1:14 am    Post subject: Reply with quote

The "Standard" PDI Headr Pinout is shown in the Atmel Application Note AVR042: AVR Hardware Design Considerations .

Section 4.3 shows a top down view of the 6-Pin Header routinely used for the PDI interface.

I use the AVR ISPmkII through AVR Studio V4 or V6.

Perhaps others can comment on using it from within Bascom.

JC
Back to top
View user's profile Visit poster's website
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Wed Aug 29, 2012 9:18 am    Post subject: Reply with quote

Hello,

Quote:
I'm just looking at using an ATxmega for the faster 12 bit A-Ds.

This is not that complicated. See CONFIG ADCx


Quote:
Is this achieved by hooking it onto the PDI pins somehow.?

Yes and JC posted the pin-out.


Quote:
Is it then possible to set fuses etc from Bascom?

No. You can not set the fuses from Bascom but with an AVR ISP MKII or (similar device) over AVR Studio 4.
Usually you do not set fuse bits very often so I set it with AVR Studio and then I use the MCS-Bootloader to update the ATXMEGA Flash in a convenient way over USB.
With ATTINY and ATMEGA you need to set the clock fuse bits in order to work with your frequency of choice.
With an ATXMEGA you do not need to set the fuse bits for clock settings. You program the clock frequency you want to have.

For example using the internal 32MHz clock:

Code:
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled       '32MHz and 32KHz enabled
Config Sysclock = 32mhz



MAK3
Back to top
View user's profile
mlcarter

Bascom Member



Joined: 12 May 2009
Posts: 11

newzealand.gif
PostPosted: Sun Sep 02, 2012 9:24 pm    Post subject: Reply with quote

Thanks very much Your help. I'll have a go.
Just didn't seem right to program a single input/output data line with an SPI programmer with separate input and output!
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum