Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Problem in running NIOS II Software Project on Altera

I keep getting this error while trying to run software projects built in NIOS II IDE

using cable "usb-blaster [usb-0]", device 1, instance 0x00

pausing target processor: not responding.

resetting and trying again: failed

leaving target processor paused

I've re-synthesized the standard niosII_cycloneII_2c35 example and did the pin assignments correctly.

(but while building the programmable file it says time limited version )

Is it a licensing issue ?

Can someone plz help me ?

Thanks in advance.

17 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I had similar problem.

    My problem is caused by hard watchdog which produces reset.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    @mmTsuchi

    pls give brief descripion about your problem

    like give some code snipet or error result etc.......

    so we can find exact solution

    Regards,

    jayesh
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey Guys .

    Have been doing some of RS232 uart work .

    I've successfully written data to computer via RS232 uart but having some problems reading data through serial isr.

    I've configured the# defined the uart base address and uart irq that was shown in sopc builder and used some of code posted by some person .

    Here's the code :

    # include <stdio.h># include <unistd.h># include <sys/alt_irq.h># include "sys/alt_stdio.h"# include "system.h"# include "alt_types.h"# include "altera_avalon_uart_regs.h"

    # define Switches (volatile char *) 0x00011040# define LEDs (char *) 0x00011050# define UART0_BASE (char *) 0x00011000# define UART0_IRQ 1# define TIMER0_BASE (char *) 0x00011020

    void uart0_put_char(unsigned char ch)

    {

    while((IORD_ALTERA_AVALON_UART_STATUS(UART0_BASE) & 0x040) != 0x040){ ;}

    IOWR_ALTERA_AVALON_UART_TXDATA(UART0_BASE,ch);

    }

    void uart0_put_str(unsigned char * str){

    while(*str){

    uart0_put_char(*str);

    str++;

    }

    }

    void uart_handle(void *context,alt_u32 interrupt)

    {

    unsigned short int data,status;

    //status = IORD_ALTERA_AVALON_UART_STATUS(UART_0_BASE);

    //while (!(status & ALTERA_AVALON_UART_STATUS_RRDY_MSK))

    status = IORD_ALTERA_AVALON_UART_STATUS(UART0_BASE);

    data =IORD_ALTERA_AVALON_UART_RXDATA(UART0_BASE);

    /*

    //write status reg;

    status = ALTERA_AVALON_UART_STATUS_TRDY_MSK;

    IOWR_ALTERA_AVALON_UART_STATUS(UART0_BASE, status);

    IOWR_ALTERA_AVALON_UART_TXDATA(UART0_BASE, data);

    IOWR_ALTERA_AVALON_UART_STATUS(UART0_BASE, 0);

    */

    }

    void uart_init()

    {

    alt_u32 control;

    volatile unsigned long uart_capture;

    // int divisor;

    alt_putstr("Debug 1\n");

    control = ALTERA_AVALON_UART_CONTROL_TRDY_MSK | ALTERA_AVALON_UART_CONTROL_RRDY_MSK | ALTERA_AVALON_UART_CONTROL_E_MSK;

    IOWR_ALTERA_AVALON_UART_CONTROL(UART0_BASE, control);

    alt_putstr("Debug 2\n");

    // divisor = (int)(50000000/9600+0.5);

    // IOWR_ALTERA_AVALON_UART_DIVISOR(UART0_BASE, divisor);

    alt_putstr("Debug 3\n");

    if (alt_irq_register(UART0_IRQ, (void*)uart_capture, uart_handle)){

    alt_putstr("Debug 4\n");

    }else{

    alt_putstr("Debug 5\n");

    }

    }

    int main(){

    printf("Hello from NIOS II \n");

    uart_init();

    //usleep(1000000);

    printf("Hello from NIOS III \n");

    uart0_put_str("Hello World");

    while(1){

    *LEDs = *Switches;

    }

    return 0;

    }

    i only get output upto :

    Hello from NIOS II

    Debug 1

    Debug 2

    Debug 3

    There seems to be problem while registering for irq in statement:

    alt_irq_register(UART0_IRQ, (void*)uart_capture, uart_handle)

    Can anyone plz tell me what's the actual way to do it ? And why my code is hanging on this statement.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Success with timer interrupt and serial interrupt at last !!!

    Here's the code :

    /*

    * "Hello World" example.

    *

    * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on

    * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example

    * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT

    * device in your system's hardware.

    * The memory footprint of this hosted application is ~69 kbytes by default

    * using the standard reference design.

    *

    * For a reduced footprint version of this template, and an explanation of how

    * to reduce the memory footprint for a given application, see the

    * "small_hello_world" template.

    *

    */# include <stdio.h># include <unistd.h># include <fcntl.h># include "sys/alt_stdio.h"# include "system.h"# include "alt_types.h"# include "altera_avalon_uart_regs.h"# include "altera_avalon_timer_regs.h"# include "sys/alt_irq.h"

    # define Switches (volatile char *) 0x00041040# define LEDs (char *) 0x00041050# define UART0_BASE (char *) 0x00041000# define UART0_IRQ 1# define TIMER0_IRQ 2# define TIMER0_BASE (char *) 0x00041020

    void uart0_put_char(unsigned char ch)

    {

    while((IORD_ALTERA_AVALON_UART_STATUS(UART0_BASE) & 0x040) != 0x040){ ;}

    IOWR_ALTERA_AVALON_UART_TXDATA(UART0_BASE,ch);

    }

    void uart0_put_str(unsigned char * str){

    while(*str){

    uart0_put_char(*str);

    str++;

    }

    }

    void uart_handle(void *context,alt_u32 interrupt)

    {

    unsigned short int data,status;

    status = IORD_ALTERA_AVALON_UART_STATUS(UART0_BASE);

    data =IORD_ALTERA_AVALON_UART_RXDATA(UART0_BASE);

    *LEDs=(char)data;

    }

    void uart_init()

    {

    alt_u32 control;

    volatile unsigned long uart_capture;

    control = ALTERA_AVALON_UART_CONTROL_TRDY_MSK | ALTERA_AVALON_UART_CONTROL_RRDY_MSK | ALTERA_AVALON_UART_CONTROL_E_MSK;

    IOWR_ALTERA_AVALON_UART_CONTROL(UART0_BASE, control);

    if (alt_irq_register(UART0_IRQ, (void*)uart_capture, uart_handle)){

    alt_putstr("UART0_IRQ Register Successful\n");

    }else{

    alt_putstr("UART0_IRQ Register UnSuccessful\n");

    }

    }

    void handle_timer_interrupt (void* context, alt_u32 id){

    static alt_u32 value = 0x00;

    value = value + 1;

    if(value % 1000 == 0){

    *LEDs=(char)value;

    }

    IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER0_BASE,0); // Clear the interrupt flag

    }

    void timer_init(){

    IOWR_ALTERA_AVALON_TIMER_CONTROL (TIMER0_BASE,ALTERA_AVALON_TIMER_CONTROL_ITO_MSK | ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK);

    alt_irq_register(TIMER0_IRQ, 0, handle_timer_interrupt);

    }

    int main(){

    printf("Hello from NIOS II \n");

    uart_init();

    printf("uart init successful");

    timer_init();

    printf("timer init successful");

    //usleep(1000000);

    printf("Hello from NIOS III \n");

    *LEDs = 0xAA;

    printf("Switch Status : %x " , (char)*Switches);

    uart0_put_str("Hello World");

    while(1){

    //*LEDs = *Switches;

    printf("hello");

    }

    return 0;

    }

    I've used LEDs to be driven in both serial interrupt and timer interrupt (plz don't mind)

    (Check your base addresses and irq number generated by SOPC if you are going to try this code)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello Everybody,

    I've a serious problem, can anyone guide me plz it is really urgent,

    m a beginner with Nios II IDE , and i was trying to upload hello World program into the DE2 but i face all the same problem: when i click on Run As:

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00.

    Pausing target processor: not responding.

    Resetting and trying again: FAILED.

    Leaving target processor paused.

    I followed all the steps on the tutorials, but i could not troubleshoot the problem.

    I tried version 7 and version 9.1 on Windows 7 and windows XP, same thing

    Can any one guide me plz,

    thank you
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Nios II IDE couldn't pause processor

    Have you recompiled all project :

    * recompile hardware using Quartus II

    * download .pof file

    * recompile software using NIOS II IDE whose version matches Quartus version

    * compile with the hardware "library" linked to the good .pof (i think, i don't exactly remember)

    * download software files using only one USB Blaster (without USB to serial cables plugged into computer)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    OOoooHHHH i'm such a donkey!!! Nios's reset pin is reset_n people watch that do not hook it with GND. lost 2 hours messing around with that.