Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

Max 10 ADC: Nios stuck at endless loop in alt_irq_handler()

Honored Contributor II


I'm trying to get ADC to run with Deca Max 10 Evaluation board. When debugging the program in Nios, it appears to get stuck in the alt_irq_handler() function. 


active = alt_irq_pending (); do { i = 0; mask = 1; /* * Test each bit in turn looking for an active interrupt. Once one is * found, the interrupt handler asigned by a call to alt_irq_register() is * called to clear the interrupt condition. */ do { if (active & mask) { # ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT alt_irq.handler(alt_irq.context); # else alt_irq.handler(alt_irq.context, i); # endif break; } mask <<= 1; i++; } while (1); active = alt_irq_pending (); } while (active);# endif /* ALT_CI_INTERRUPT_VECTOR */ 


I have no clue why it's stuck here???? Following is my simple code for reading ADC in main() function and attached file is the Qsys configuration. 


int count = 0; alt_u32 adc_data; /* Initialize adc */ adc_stop(ADC_SEQUENCER_CSR_BASE); adc_interrupt_disable(ADC_SEQUENCER_CSR_BASE); // Disable interrupt adc_clear_interrupt_status(ADC_SEQUENCER_CSR_BASE); adc_set_mode_run_continuously(ADC_SEQUENCER_CSR_BASE); // Set ADC run mode adc_start(ADC_SEQUENCER_CSR_BASE); // start sampling for(alt_u32 sampleCnt=0; sampleCnt<100; sampleCnt++) // read 1000 samples { alt_adc_word_read(ADC_SAMPLE_STORE_CSR_BASE, adc_data, ADC_SAMPLE_STORE_CSR_CSD_LENGTH); count++; } adc_stop(ADC_SEQUENCER_CSR_BASE); // Stop ADC sampling while (1);  


Any help would be really appreciated. 

0 Kudos
0 Replies