Xmega does not boot application program

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

Hello,

 

In the last few years I have developed some projects using the xmega micro controller and every time when I have face an issue I have received help from this forum. Hoping someone could help me this time too.

 

 

Problem:

I am developing a new project using Xmega microcontroller. I first developed a prototype using xmega128a4u and used Atmel Studio. Everything was working fine. Later I developed a PCB using the schematic attached(Not complete schematic attached.) where I changed some port pins for alignment purposes. I recompiled the code by changing the device to xmega32a4u. 

 

The program compiles and flashes successfully on xmega32a4u however the application does not boot. I noticed that the port pins are also getting configured correctly according to the program but the program does not run. 

 

Can anyone help me here ? Thank you

 

 

 

Below are the fuse settings i always use:

 

WDWP = 8CLK
WDP = 8CLK
BOOTRST = APPLICATION
TOSCSEL = XTAL
BODPD = CONTINUOUS
RSTDISBL = [ ]
SUT = 0MS
WDLOCK = [ ]
BODACT = DISABLED
EESAVE = [X]
BODLVL = 1V8

FUSEBYTE1 = 0x00 (valid)
FUSEBYTE2 = 0xFE (valid)
FUSEBYTE4 = 0xFE (valid)
FUSEBYTE5 = 0xF6 (valid)

 

 

 

Schematic:

 

 

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

drushil wrote:
SUT = 0MS

This is too short for a xtal, they take some time to start up, choose the longest time available (32-64ms?). 

Not sure that is your problem though. 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Not likely related to your current problem, but be very careful if you tie I/O pins directly to Ground.

 

If you mistakenly make a pin an output, and set it high, or an error in your code does this, then the connection to Ground essentially is a short circuit between Vcc and Ground.

 

This can destroy that I/O pin, and perhaps more of the chip.

 

JC

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

The project I am developing is used in a highly noisy environment with alot of high voltage Analog wires..in my last prototype this was causing undesired triggers.. So I grounded the unused pins this time.

Considering that the programming on xmega is working and Io ports can be configured..I guess the microcontroller is not destroyed..

Can reset be an issue here ?

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

Here are the differences I can think of.

 

The 128 has more app flash and bootloader flash and EEPROM.

 

The 128 bootloader flash starts at a higher address.

Last Edited: Thu. Aug 8, 2019 - 01:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was able to narrow the problem using a debugger

 

	pmic_init();
	sysclk_init();

	RTC_init();

	system_timer_init();
	
	...etc etc

I noticed that the program gets stuck at RTC

 

void RTC_init(void)
{
	//Important!!! First enable the clock, then configure the timer
	sysclk_enable_module(SYSCLK_PORT_GEN, SYSCLK_RTC);			//enable clock for RTC
	CLK.RTCCTRL = CLK_RTCSRC_TOSC_gc | CLK_RTCEN_bm;			// set clock source to RTC (1.024kHz from 32.768kHz crystal on TOSC)

	OSC.XOSCCTRL |= OSC_X32KLPM_bm;								// 32kHz XTAL OSC Low-power Mode set
	OSC.XOSCCTRL= OSC_XOSCSEL_32KHz_gc;
	OSC.CTRL|=OSC_XOSCEN_bm;
	while(!(OSC.STATUS&OSC_XOSCRDY_bm));
	RTC.PER = (uint16_t)RTC_PERIOD;
	RTC.CNT = 0x00;												// clear counter
	RTC.INTFLAGS |= RTC_OVFIF_bm;								// clear interrupt flag
	RTC.INTCTRL = RTC_OVFINTLVL_HI_gc;							// set interrupt levels
	RTC.CTRL = RTC_PRESCALER_DIV1024_gc;						// set prescaler (1024)
	while (RTC.STATUS & RTC_SYNCBUSY_bm);						// waiting for synchronization
}

 

the program was stuck at "while(!(OSC.STATUS&OSC_XOSCRDY_bm));"

 

Any idea what i can do to solve this ?

 

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

Does any program run on this board?

 

Are you using a crystal?  If so, does the crystal exist?

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

Yes there is a crystal and it is present.

 

I have two pcs. After trying different fuse combinations and flashing multiple times finally one board is working. 

Now I have entered the same fuse settings on a second PCB and I am facing the same problem.

 

Any suggestions ?

 

it is getting stuck at the same location.

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

drushil wrote:
Now I have entered the same fuse settings on a second PCB and I am facing the same problem.

And what are the new fuse settings?   Do they include the suggestion in #2?

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

These are the fuse settings where PCB 1 finally worked/working but they don't work on the second PCB (2nd PCB is behaving exactly same as the first one was )

WDWP = 8CLK
WDP = 8CLK
BOOTRST = APPLICATION
TOSCSEL = XTAL
BODPD = CONTINUOUS
RSTDISBL = [ ]
SUT = 4MS
WDLOCK = [ ]
BODACT = DISABLED
EESAVE = [X]
BODLVL = 1V8

One PCB 1 I had to burn the fuses multiple times /change the SUT also back and forth..

Can something be wrong with the crystal ? Because the program hangs in the RTC loop ?

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

is that the longest SUT period you can set?

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

There are only 3 options shown in the atmel studio fuse programming window

0, 4MS and 64MS.

I tried all