Atmel Studio 6.2: Failed to launch program

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

   

Hello AVRFreaks,

 

I am using a REB233SMAD-EK radio extender board in conjunction with an AVRISP MKii programmer in Atmel Studio 6.2 (most recent update). When trying to debug the following code, Atmel Studio consistently displays an error message stating "Failed to launch program. Error: Failed to start programming session before chip erase with eeprom preserve:Failed to enter programming mode. Error status received from tool: Result received is 0x03.":

/*
 * Hello_World.c
 *
 * Created: 8/21/2015 2:23:17 PM
 *  Author: Hugo
 */ 


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

static int uart_putchar(char c, FILE *stream);
static void uart_init (void);

static FILE mystdout = FDEV_SETUP_STREAM (uart_putchar, NULL, _FDEV_SETUP_WRITE);


int main (void)
{
	uart_init();
	stdout = &mystdout;
	
	while (1)
	printf("Hello, world!\n");
}


static int uart_putchar (char c, FILE *stream)
{
	if (c == '\n')
	uart_putchar('\r', stream);
	
	// Wait for the transmit buffer to be empty
	while ( !( USARTC0.STATUS & USART_DREIF_bm) );
	
	// Put our character into the transmit buffer
	USARTC0.DATA = c;
	
	return 0;
}


// Init USART.  Transmit only (we're not receiving anything)
// We use USARTC0, transmit pin on PC3.
// Want 9600 baud. Have a 2 MHz clock. BSCALE = 0
// BSEL = ( 2000000 / (2^0 * 16*9600)) -1 = 12
// Fbaud = 2000000 / (2^0 * 16 * (12+1))  = 9615 bits/sec
static void uart_init (void)
{
	// Set the TxD pin high - set PORTC DIR register bit 3 to 1
	PORTC.OUTSET = PIN3_bm;
	
	// Set the TxD pin as an output - set PORTC OUT register bit 3 to 1
	PORTC.DIRSET = PIN3_bm;
	
	// Set baud rate & frame format
	USARTC0.BAUDCTRLB = 0;			// BSCALE = 0 as well
	USARTC0.BAUDCTRLA = 12;
	
	// Set mode of operation
	USARTC0.CTRLA = 0;				// no interrupts please
	USARTC0.CTRLC = 0x03;			// async, no parity, 8 bit data, 1 stop bit
	
	// Enable transmitter only
	USARTC0.CTRLB = USART_TXEN_bm;
}

Any help would be appreciated!!!

Last Edited: Wed. Aug 26, 2015 - 09:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

AVRISPmkII is just a programmer, it can't debug.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

I understand that. I believe that Atmel Studio acts as the debugger, correct? However, when I try to debug the code posted above, Atmel Studio displays an error message stating that it is unable to even enter programming mode, which should not be occurring (I think), as you, yourself, said that the AVR ISP MKII is simply a programmer. I am fairly new to Atmel products and Atmel Studio, so please correct me if I am wrong. Thanks.

 

 

Last Edited: Thu. Aug 27, 2015 - 01:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

What "debugs"? Can you describe exactly what are you doing, including all the buttons you click?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

First, I open up Atmel Studio 6.2. Then, I select my project which contains the code posted above. After that, I choose my device (ATxmega256A3) and tool (AVR ISP MKii). The interface is then set to PDI, as I am without the option to select another interface. That is all I do before clicking debug (f5). Thanks.

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

poroko wrote:
That is all I do before clicking debug (f5).
And that's your problem. AVRISPmkII does not support debugging. You can only program the part. So open Device Programming dialog, go to the Memories tab and go from there.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

But where do I "go from [the Memories tab]"? Posted below is what my Memories tab looks like (some options are disabled). I've tried unchecking the different options and programming, verifying, and reading, with no luck. When I click 'program', this is the error message I get: "[ERROR] Failed to enter programming mode. Error status received from tool: Result received is 0x03., ModuleName: TCF (TCF command: Device:startSession failed.)." Thanks again.

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

Does "Read" next to "Device signature" work? If it does not, then there is something wrong with either the part of the programmer.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

No, it doesn't work. Instead, I get this message: "Unable to enter programming mode. Please verify device selection, interface settings, target power and connections to the target device. Look in the details section for more information." 

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

Then it looks like it is either a problem with programmer, the MCU or connection between them.

 

There is also a chance that support for AVRISPmkII is broken in AS.

 

I suggest you contact the official support. They might actually have an answer.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Okay, thanks.