Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Atmel Studio 6.2: Failed to launch program

Status
Not open for further replies.

poroko

New Member
Hi all,

I am using two REB233SMAD-EK radio extender boards and an AVRISP mkii programmer in Atmel Studio 6.2. Though the two boards seem to be recognizing each other (apparent in terminal), I cannot find a way in which to get them to send/receive a simple message (such as "Hello World!"). I've been told that the AVRISP mkii is simply a programmer, so in other words, it doesn't debug. Because of this, whenever I try 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.":

Code:
/*
* 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;
}

I'm unsure of how to get this message communicated between my two boards using the AVRISP mkii. Would I need a debugger? Is there a way I can program without it? I am a neophyte when it comes to programming, so any help would be very appreciated!!
 
Thank you, but I'm not sure you understood the question? I'm trying to work out a code between Atmel Studio 6.2, two atxmega256a3's, and an avrisp mkii.
 
Okay! There's no need to give me a dislike!! I'm here to help.

The topic clearly says " Failure to launch program" The AVR studio has to execute programs on the fly... I have had this problem in Windows 7 which is why I asked the question...

If you are going to give me negative feedback every question I try and help with, its going to be VERY unnfair!
 
All right, sorry about that; I thought you misinterpreted what I was asking. Yes, I am using Windows 7. What next?
 
The first thing to try is when you run AVR studio.. Right click and run as administrator... If the problem still exists then the programmer is looking for specific debug hardware... However! The "Failure to launch program" message to me only implies a PC access problem... If AVR could not find the programmer it wouldn't report that message..

Is the AVRISP programmer remotely connected? The programmer may use DTR or RTS to control byte flow...

BTW I have never tried debugging in this way..... Does the AVR program alright before trying to debug, or are you doing all in one...
 
Sorry for the late response! And thank you for your suggestions! Running Atmel Studio seems like a good idea, but I am a student using a school computer (thus, no administrative rights). I will try to see if I can download Atmel Studio onto my own computer, or if I can be granted momentary administrative rights. I'm not sure if this is the problem, though, because if Atmel Studio needed administrative rights to run certain programs wouldn't Windows still ask for the permission? Or is permission bypassed when using a third party application? I'm pretty sure that Atmel Studio is recognizing the AVRISP because it appears under tools in the top right corner. The AVRISP is not remotely connected, it is attached to the pc using jumper wires. Atmel Studio seems to present the same error of "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." when programming without debugging.
Thanks again! (Sorry if the message is confusing to follow).
 
When, on your own computer, you can "right click" any program and run as administrator..

The error messages seem weird...

"Failed to program" seems like a connection fault!! As if the sequence has been aborted!

Like I said before... Some serial programmers use the DTR or RTS to signal programming!
 
Yes, I understand that one could "'right click' any program and run as administrator"; however, I am not an administrator on my school's computer, thus I can NOT run as administrator!

Have you worked with Atmel Studio? Or the REB233SMAD-EK or AVRISP mkII? I'm not entirely sure of how to check for successful connections... I'm pretty sure that AVRISP mkII is successfully connected to the pc and radio extender board (successful connection is signaled by two LED diodes shining green on the AVRISP, and tool appears automatically on Atmel Studio toolbar in upper right hand corner). I suppose there could be a faulty connection between the board and the pc, it's just that there is only the board and the usb cable (It would be very difficult to connect these improperly, but it could definitely be a cause... I just need to find a troubleshooter for the connection/guide for proper connection).

Sorry, but what are DTR and RTS? I can only find the following online, and I'm still not sure what they are/mean:
  • DTR - Data Terminal Ready
  • DSR - Data Set Ready
  • RTS - Request To Send
  • CTS - Clear To Send
Thanks again
 
When, on your own computer

I appreciate the problems of getting something to work on a school / college computer.. I don't use any of those boards... I have the original AVR isp... The device uses RTS, DSR and CTS as control


I would have thought the newer one would be similar or is it USB connection!
 
I don't really understand the diagram, but the AVRISP mkII uses a USB connection. Thanks for your help, but it seems that the programmer may be faulty-- I might end up having to purchase a new one.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top