- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, recently I've been doing some designs with the MAX10 FPGA and I've faced some issues in regards to the Sample Storage mode of operation that the ADC module IP from Altera gives.
The process that I'm developing is this one: 1 - disable the interrupt; 2 - register the ISR; 3 - enabling the interrupt - I don't know if the ADC starts the conversion at this point, cause I'm only enabling the interrupt, but I'm not invoking the "adc_start" API, which starts the ADC for the sequencer mode. :confused::confused::confused: 4 - in an infinite loop waiting for the interruption - however it never occurs. I`ve read a couple of articles and codes that implement an interrupt that is triggered by a button from the board, but I couldn't find anything that is related with the modular ADC, and the documentation that Altera provides does not explain any coding process to get the sample storage mode working. This is the code I'm running:#include<stdio.h># include "alt_types.h"# include "system.h"# include "altera_avalon_pio_regs.h"# include "altera_modular_adc_sample_store_regs.h"# include "altera_modular_adc_sequencer_regs.h"# include "altera_modular_adc.h"# include "sys/alt_irq.h"# include "priv/alt_iic_isr_register.h"# include "sys/alt_alarm.h"
# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
static void adcInterrupt(void* context)# else
static void adcInterrupt(void* context, alt_u32 id)# endif
{
printf("Interrrrrrrrrruption!!!!!!!!!!!!");
adc_clear_interrupt_status(MODULAR_ADC_SAMPLE_STORE_CSR_BASE);
volatile int* edge_capture_ptr = (volatile int*) context;
//Interruption handler
}
int main(void){
printf("*** The ADC has started ***\n");
alt_u32 *adc_data_ptr;
alt_u32 line_in_data;
printf("*** Configure and start the sample_store config ***\n");
//Disable the interrupt
ALTERA_MODULAR_ADC_SAMPLE_STORAGE_IRQ_DISABLE(MODULAR_ADC_SAMPLE_STORE_CSR_BASE);
//Configuring the interrupt# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
alt_ic_isr_register (MODULAR_ADC_SAMPLE_STORE_CSR_IRQ_INTERRUPT_CONTROLLER_ID,
MODULAR_ADC_SAMPLE_STORE_CSR_IRQ,
adcInterrupt,
(void *)MODULAR_ADC_SAMPLE_STORE_CSR_BASE,
(void *)0);# else
alt_irq_register (MODULAR_ADC_SAMPLE_STORE_CSR_IRQ, MODULAR_ADC_SAMPLE_STORE_CSR_BASE, adcInterrupt);# endif
//enabling the interrupt
alt_ic_irq_enable(MODULAR_ADC_SAMPLE_STORE_CSR_IRQ_INTERRUPT_CONTROLLER_ID,
MODULAR_ADC_SAMPLE_STORE_CSR_IRQ);
adc_interrupt_enable(MODULAR_ADC_SAMPLE_STORE_CSR_BASE);
//adc_start(MODULAR_ADC_SEQUENCER_CSR_BASE);
printf("*** All enabled ***\n");
while(1){
adcSampleStorageIRQStatus=READ_ALTERA_MODULAR_ADC_SAMPLE_STORAGE_IRQ_STATUS(MODULAR_ADC_SAMPLE_STORE_CSR_BASE);
printf("IRQ Status: %d",adcSampleStorageIRQStatus);
adcInterruptAsserted=adc_interrupt_asserted(MODULAR_ADC_SAMPLE_STORE_CSR_BASE);
printf("Interrupt Asserted?: %d\n",adcInterruptAsserted);
}
return 0;
}
Thanks!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you include a ADC interrupt routine code? If there is no interrupt routine, your system will not be able to detect any interrupt.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page