From: bish on 26 Nov 2008 02:18 On Nov 26, 3:29 am, Bryan <bryan.fletc...(a)avnet.com> wrote: > There is a 9.2 MicroBlaze Timer Interrupt example done by Avnet atwww.em.avnet.com/virtex4lx-sx-mb-dev, then click Support Files & > Downloads. > I downloaded V4MB_SX35_interrupt_Design_Rev2_Rev3 example design, it had used two timers, so I commented out the second timer relevant codes and used only a single timer from its system.c file, still the problem is the interrupt handler seems never to be called. I am trying to use a single timer for interrupt and this is the only device to generate an interrupt. Is it possible that the XPS Interrupt Controller when used must need more than one interrupt inputs?? Because I still cannot figure out what the problem is, I have tried quite a few other examples too. Another one I used from other example design has: And this is also not working!!! Can anybody check the following out in edk 9.2: using ONLY ONE TIMER (from XPS_TIMER) and XPS interrupt controller??? Using the code given below:: // Driver instances //static XGpio myGpio; static XTmrCtr myTimer; static XIntc myIntc; // Timer ISR: void timer_a_int_handler(void *CallBackRef/*, Xuint8 TmrCtrNumber*/) { //if (TmrCtrNumber==0) { xil_printf("In timer interrupt handler... waiting for 3 seconds\r\n"); //usleep(3000000); xil_printf("Leaving timer interrupt handler ...\r\n"); //} //Clear the interrupt XIntc_Acknowledge (&myIntc,XPAR_XPS_INTC_0_XPS_TIMER_0_INTERRUPT_INTR); } // Main: this is the function that is executed at the start of the program. int main(){ //********************** 1. Device initialization and configuration ************************* xil_printf("Setting up peripherals...\r\n"); //Initialize and configuring the timer XTmrCtr_Initialize(&myTimer, XPAR_XPS_TIMER_0_DEVICE_ID); //XTmrCtr_SelfTest(&myTimer, 0); XTmrCtr_SetOptions(&myTimer,(Xuint8)0,XTC_INT_MODE_OPTION | XTC_DOWN_COUNT_OPTION | XTC_AUTO_RELOAD_OPTION); XTmrCtr_SetHandler(&myTimer,(XTmrCtr_Handler) timer_a_int_handler,NULL); //*************** 2. Interrupt controller initialization and configuration ****************** xil_printf("Setting up interrupt controller...\r\n"); XIntc_Initialize(&myIntc, XPAR_XPS_INTC_0_DEVICE_ID); //Attach the ISRs to the interrupt controller driver. XIntc_Connect(&myIntc, XPAR_XPS_INTC_0_XPS_TIMER_0_INTERRUPT_INTR, (XInterruptHandler) XTmrCtr_InterruptHandler, &myTimer); XIntc_Start(&myIntc, XIN_REAL_MODE); XIntc_Enable(&myIntc, XPAR_XPS_INTC_0_XPS_TIMER_0_INTERRUPT_INTR); //Set the timer to expire every 6 seconds XTmrCtr_SetResetValue(&myTimer, (Xuint8)0, 6 * 50000000); XTmrCtr_Start(&myTimer, (Xuint8)0); xil_printf("Entering loop...\r\n"); while(1){ //xil_printf("in loop..\r\n"); } } > Bryan > > On Nov 24, 7:19 pm, bish <bishes...(a)gmail.com> wrote: > > > > > I am trying to use a timer for regular interrupt in microblaze. I am > > using edk 9.2i and spartan 3a dsp 1800a. > > Even following a simple lab example widely used by beginners didn't > > work:http://users.utcluj.ro/~baruch/ssce/labor/EDK-L5-e.pdf > > > I have connected all the interrupt ports correctly as evident from the > > following portion of the mhs file: > > BEGIN microblaze > > PARAMETER HW_VER = 7.00.a > > ........... > > ........... > > PORT INTERRUPT = interrupt > > END > > > BEGIN xps_timer > > PARAMETER INSTANCE = delay > > PARAMETER HW_VER = 1.00.a > > PARAMETER C_ONE_TIMER_ONLY = 1 > > PARAMETER C_BASEADDR = 0x8141c200 > > PARAMETER C_HIGHADDR = 0x8141c3ff > > BUS_INTERFACE SPLB = mb_plb > > PORT Interrupt = timer1 > > PORT CaptureTrig0 = net_gnd > > END > > > BEGIN xps_intc > > PARAMETER INSTANCE = xps_intc_0 > > PARAMETER HW_VER = 1.00.a > > PARAMETER C_BASEADDR = 0x81418000 > > PARAMETER C_HIGHADDR = 0x814181ff > > BUS_INTERFACE SPLB = mb_plb > > PORT Irq = interrupt > > PORT Intr = timer1 > > END > > > Now for the software settings since I am using edk 9.2i, it does not > > have option for registering our interrupt handler in software platform > > settings window (which is what the lab suggests), I used the > > microblaze_register_handler(...) function ( I took me 3 days to figure > > out this), but I still don't get how it works differently from the > > function XIntc_RegisterHandler. > > The portion of C file is as follows: > > void timer_int_handler(void * baseaddr_p) { > > /* Add variable declarations here */ > > unsigned int csr; > > /* Read timer 0 CSR to see if it raised the interrupt */ > > csr = XTmrCtr_mGetControlStatusReg(XPAR_DELAY_BASEADDR,0); > > /* If the interrupt occurred, then increment a counter */ > > /* and set one_second_flag to 1 */ > > if (csr & XTC_CSR_INT_OCCURED_MASK ) { > > count ++; > > one_second_flag = 1; > > } > > > /* Display the count on the LEDs */ > > XGpio_mSetDataReg(XPAR_LED_HIGHADDR, LEDChan, count); > > > /* Print the count using the UART*/ > > xil_printf("count value is: %x\n\r", count); > > /* Clear the timer interrupt */ > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR,0,csr); > > > } > > > int main() { > > > int count_mod_3; > > > //registering an interrupt handler > > microblaze_register_handler((XInterruptHandler) timer_int_handler, > > (void *)0); > > > /* Register the Timer interrupt handler in the vector table */ > > XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, > > XPAR_XPS_INTC_0_DELAY_INTERRUPT_INTR, > > (XInterruptHandler) timer_int_handler, > > (void *)XPAR_DELAY_BASEADDR); > > /* Enable MicroBlaze Interrupts */ > > microblaze_enable_interrupts(); > > > /* Initialize and set the direction of the GPIO connected to LEDs */ > > XGpio_Initialize(&gpio, XPAR_LED_DEVICE_ID); > > XGpio_SetDataDirection(&gpio,LEDChan, 0); > > > /* Start the interrupt controller */ > > XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR); > > XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, 0x1); > > > /* Set the gpio as output on high 8 bits (LEDs)*/ > > XGpio_mSetDataReg(XPAR_LED_DEVICE_ID,LEDChan, ~count); > > xil_printf("The value of count = %d\n\r", count); > > > /* Set the number of cycles the timer counts before interrupting */ > > XTmrCtr_mSetLoadReg(XPAR_DELAY_BASEADDR, 0, > > (timer_count*timer_count) * 50000000); > > > /* Reset the timers, and clear interrupts */ > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK ); > > > /* Enable timer interrupts in the interrupt controller */ > > XIntc_mEnableIntr(XPAR_DELAY_BASEADDR, XPAR_DELAY_INTERRUPT_MASK); > > > /* Start the timers */ > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | > > XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK); > > > /* Wait for interrupts to occur */ > > while(1) { > > if(one_second_flag){ > > count_mod_3 = count % 3; > > if(count_mod_3 == 0) > > xil_printf("Interrupt taken at %d seconds \n\r",count); > > one_second_flag=0; > > xil_printf("."); > > } > > } > > > } > > > When I run the system, the value of count does not change from 1. What > > could be the problem?- Hide quoted text - > > - Show quoted text -
From: bish on 26 Nov 2008 02:22 On Nov 26, 4:58 am, David <simianfe...(a)gmail.com> wrote: > On Nov 26, 2:37 am, bish <bishes...(a)gmail.com> wrote: > > > > > > > On Nov 25, 12:25 pm, Matthias Alles <REMOVEallesCAPIT...(a)NOeit.SPAMuni- > > > kl.de> wrote: > > > Hi! > > > > I wonder, whether "one_second_flag" is declared as volatile? If not, the > > > compiler optimizes your if-statement in the while(1) loop away. You can > > > check this by using mb-objdump. > > > I tried using the volatile for one_second_flag, still it does not > > work. It just prints "the value of count = 1" once in terminal and > > nothing happens then. > > > > Cheers, > > > Matthias > > > > bish schrieb: > > > > > I am trying to use a timer for regular interrupt in microblaze. I am > > > > using edk 9.2i and spartan 3a dsp 1800a. > > > > Even following a simple lab example widely used by beginners didn't > > > > work:http://users.utcluj.ro/~baruch/ssce/labor/EDK-L5-e.pdf > > > > > I have connected all the interrupt ports correctly as evident from the > > > > following portion of the mhs file: > > > > BEGIN microblaze > > > > PARAMETER HW_VER = 7.00.a > > > > ........... > > > > ........... > > > > PORT INTERRUPT = interrupt > > > > END > > > > > BEGIN xps_timer > > > > PARAMETER INSTANCE = delay > > > > PARAMETER HW_VER = 1.00.a > > > > PARAMETER C_ONE_TIMER_ONLY = 1 > > > > PARAMETER C_BASEADDR = 0x8141c200 > > > > PARAMETER C_HIGHADDR = 0x8141c3ff > > > > BUS_INTERFACE SPLB = mb_plb > > > > PORT Interrupt = timer1 > > > > PORT CaptureTrig0 = net_gnd > > > > END > > > > > BEGIN xps_intc > > > > PARAMETER INSTANCE = xps_intc_0 > > > > PARAMETER HW_VER = 1.00.a > > > > PARAMETER C_BASEADDR = 0x81418000 > > > > PARAMETER C_HIGHADDR = 0x814181ff > > > > BUS_INTERFACE SPLB = mb_plb > > > > PORT Irq = interrupt > > > > PORT Intr = timer1 > > > > END > > > > > Now for the software settings since I am using edk 9.2i, it does not > > > > have option for registering our interrupt handler in software platform > > > > settings window (which is what the lab suggests), I used the > > > > microblaze_register_handler(...) function ( I took me 3 days to figure > > > > out this), but I still don't get how it works differently from the > > > > function XIntc_RegisterHandler. > > > > The portion of C file is as follows: > > > > void timer_int_handler(void * baseaddr_p) { > > > > /* Add variable declarations here */ > > > > unsigned int csr; > > > > /* Read timer 0 CSR to see if it raised the interrupt */ > > > > csr = XTmrCtr_mGetControlStatusReg(XPAR_DELAY_BASEADDR,0); > > > > /* If the interrupt occurred, then increment a counter */ > > > > /* and set one_second_flag to 1 */ > > > > if (csr & XTC_CSR_INT_OCCURED_MASK ) { > > > > count ++; > > > > one_second_flag = 1; > > > > } > > > > > /* Display the count on the LEDs */ > > > > XGpio_mSetDataReg(XPAR_LED_HIGHADDR, LEDChan, count); > > > > > /* Print the count using the UART*/ > > > > xil_printf("count value is: %x\n\r", count); > > > > /* Clear the timer interrupt */ > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR,0,csr); > > > > } > > > > > int main() { > > > > > int count_mod_3; > > > > > //registering an interrupt handler > > > > microblaze_register_handler((XInterruptHandler) timer_int_handler, > > > > (void *)0); > > > > > /* Register the Timer interrupt handler in the vector table */ > > > > XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, > > > > XPAR_XPS_INTC_0_DELAY_INTERRUPT_INTR, > > > > (XInterruptHandler) timer_int_handler, > > > > (void *)XPAR_DELAY_BASEADDR); > > > > /* Enable MicroBlaze Interrupts */ > > > > microblaze_enable_interrupts(); > > > > > /* Initialize and set the direction of the GPIO connected to LEDs */ > > > > XGpio_Initialize(&gpio, XPAR_LED_DEVICE_ID); > > > > XGpio_SetDataDirection(&gpio,LEDChan, 0); > > > > > /* Start the interrupt controller */ > > > > XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR); > > > > XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, 0x1); > > > > > /* Set the gpio as output on high 8 bits (LEDs)*/ > > > > XGpio_mSetDataReg(XPAR_LED_DEVICE_ID,LEDChan, ~count); > > > > xil_printf("The value of count = %d\n\r", count); > > > > > /* Set the number of cycles the timer counts before interrupting */ > > > > XTmrCtr_mSetLoadReg(XPAR_DELAY_BASEADDR, 0, > > > > (timer_count*timer_count) * 50000000); > > > > > /* Reset the timers, and clear interrupts */ > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK ); > > > > > /* Enable timer interrupts in the interrupt controller */ > > > > XIntc_mEnableIntr(XPAR_DELAY_BASEADDR, XPAR_DELAY_INTERRUPT_MASK); > > > > > /* Start the timers */ > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | > > > > XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK); > > > > > /* Wait for interrupts to occur */ > > > > while(1) { > > > > if(one_second_flag){ > > > > count_mod_3 = count % 3; > > > > if(count_mod_3 == 0) > > > > xil_printf("Interrupt taken at %d seconds \n\r",count); > > > > one_second_flag=0; > > > > xil_printf("."); > > > > } > > > > } > > > > } > > > > > When I run the system, the value of count does not change from 1. What > > > > could be the problem?- Hide quoted text - > > > > - Show quoted text - > > Hello, > > Here is how I set up a timer interrupt in 9.2: > > void TimerCounterHandler(void *CallBackRef) > { > print("timer interrupt "); > > } > > Int main (void) { > > XIntc intr_ctrl; > XTmrCtr timr; > > XIntc_Initialize(&intr_ctrl,XPAR_XPS_INTC_0_DEVICE_ID); > XTmrCtr_Initialize(&timr,XPAR_XPS_TIMER_1_DEVICE_ID); > > XIntc_Connect(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR, > (XInterruptHandler) > XTmrCtr_InterruptHandler, > (void *)&timr); > > XIntc_Start(&intr_ctrl, XIN_REAL_MODE); > > XIntc_Enable(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR); > > XTmrCtr_SetHandler(&timr, (void *)TimerCounterHandler, void); This issued an error so I replaced void with NULL in the third argument above. Apart from that I didn't change anything, but still the terminal never printed "timer interrupt" so still the problem remains!! > > XTmrCtr_SetOptions(&timr, 0, > XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION); > > XTmrCtr_SetResetValue(&timr, 0, 0xF0000000); > > XTmrCtr_Start(&timr,0); > > microblaze_enable_interrupts(); > > while(1){ > //wait for interrupts > } > > } > > If you are using the Intc component, you no longer need to use the > microblaze_register_handler function - instead use the XIntc_Connect() > function. > The XTmrCtr driver provides its own interrupt handler > XTmrCtr_InterruptHandler() which you should use to service the > interrupt. It will issue a callback to a function of your choice (set > with XTmrCtr_SetHandler) > > Hope this helps, > > David- Hide quoted text - > > - Show quoted text -
From: Bryan on 26 Nov 2008 20:14 Not sure what the problem is with your code. Here's an example with one timer. It's 10.1, but there weren't any changes in the interrupt stuff between 9.2 and 10.1 (so I'm told). This is based on a lab from one of Avnet's Speedway trainings. I ran it on the Xilinx Spartan-3A DSP 1800A Starter and verified that the interrupts are indeed happening. There is a bit file in the project directory if you don't want to rebuild the project. Bryan The following file has been made available for you to download from Avnet's File Transfer web site: http://xfer.avnet.com/uploads/Xil3S1800ADSP_Interrupt_v10.1.03.zip Click on the hyperlink or enter this URL into your web browser to retrieve the file. This file will remain on the server for approximately 5 days from the date of the upload at which time it will be deleted. Please be sure to download it before the expiration time. This file will expire on Dec 1, 2008. File Size: 232357 Bytes On Nov 26, 12:22 am, bish <bishes...(a)gmail.com> wrote: > On Nov 26, 4:58 am, David <simianfe...(a)gmail.com> wrote: > > > > > > > On Nov 26, 2:37 am, bish <bishes...(a)gmail.com> wrote: > > > > On Nov 25, 12:25 pm, Matthias Alles <REMOVEallesCAPIT...(a)NOeit.SPAMuni- > > > > kl.de> wrote: > > > > Hi! > > > > > I wonder, whether "one_second_flag" is declared as volatile? If not, the > > > > compiler optimizes your if-statement in the while(1) loop away. You can > > > > check this by using mb-objdump. > > > > I tried using the volatile for one_second_flag, still it does not > > > work. It just prints "the value of count = 1" once in terminal and > > > nothing happens then. > > > > > Cheers, > > > > Matthias > > > > > bish schrieb: > > > > > > I am trying to use a timer for regular interrupt in microblaze. I am > > > > > using edk 9.2i and spartan 3a dsp 1800a. > > > > > Even following a simple lab example widely used by beginners didn't > > > > > work:http://users.utcluj.ro/~baruch/ssce/labor/EDK-L5-e.pdf > > > > > > I have connected all the interrupt ports correctly as evident from the > > > > > following portion of the mhs file: > > > > > BEGIN microblaze > > > > > PARAMETER HW_VER = 7.00.a > > > > > ........... > > > > > ........... > > > > > PORT INTERRUPT = interrupt > > > > > END > > > > > > BEGIN xps_timer > > > > > PARAMETER INSTANCE = delay > > > > > PARAMETER HW_VER = 1.00.a > > > > > PARAMETER C_ONE_TIMER_ONLY = 1 > > > > > PARAMETER C_BASEADDR = 0x8141c200 > > > > > PARAMETER C_HIGHADDR = 0x8141c3ff > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > PORT Interrupt = timer1 > > > > > PORT CaptureTrig0 = net_gnd > > > > > END > > > > > > BEGIN xps_intc > > > > > PARAMETER INSTANCE = xps_intc_0 > > > > > PARAMETER HW_VER = 1.00.a > > > > > PARAMETER C_BASEADDR = 0x81418000 > > > > > PARAMETER C_HIGHADDR = 0x814181ff > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > PORT Irq = interrupt > > > > > PORT Intr = timer1 > > > > > END > > > > > > Now for the software settings since I am using edk 9.2i, it does not > > > > > have option for registering our interrupt handler in software platform > > > > > settings window (which is what the lab suggests), I used the > > > > > microblaze_register_handler(...) function ( I took me 3 days to figure > > > > > out this), but I still don't get how it works differently from the > > > > > function XIntc_RegisterHandler. > > > > > The portion of C file is as follows: > > > > > void timer_int_handler(void * baseaddr_p) { > > > > > /* Add variable declarations here */ > > > > > unsigned int csr; > > > > > /* Read timer 0 CSR to see if it raised the interrupt */ > > > > > csr = XTmrCtr_mGetControlStatusReg(XPAR_DELAY_BASEADDR,0); > > > > > /* If the interrupt occurred, then increment a counter */ > > > > > /* and set one_second_flag to 1 */ > > > > > if (csr & XTC_CSR_INT_OCCURED_MASK ) { > > > > > count ++; > > > > > one_second_flag = 1; > > > > > } > > > > > > /* Display the count on the LEDs */ > > > > > XGpio_mSetDataReg(XPAR_LED_HIGHADDR, LEDChan, count); > > > > > > /* Print the count using the UART*/ > > > > > xil_printf("count value is: %x\n\r", count); > > > > > /* Clear the timer interrupt */ > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR,0,csr); > > > > > } > > > > > > int main() { > > > > > > int count_mod_3; > > > > > > //registering an interrupt handler > > > > > microblaze_register_handler((XInterruptHandler) timer_int_handler, > > > > > (void *)0); > > > > > > /* Register the Timer interrupt handler in the vector table */ > > > > > XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, > > > > > XPAR_XPS_INTC_0_DELAY_INTERRUPT_INTR, > > > > > (XInterruptHandler) timer_int_handler, > > > > > (void *)XPAR_DELAY_BASEADDR); > > > > > /* Enable MicroBlaze Interrupts */ > > > > > microblaze_enable_interrupts(); > > > > > > /* Initialize and set the direction of the GPIO connected to LEDs */ > > > > > XGpio_Initialize(&gpio, XPAR_LED_DEVICE_ID); > > > > > XGpio_SetDataDirection(&gpio,LEDChan, 0); > > > > > > /* Start the interrupt controller */ > > > > > XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR); > > > > > XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, 0x1); > > > > > > /* Set the gpio as output on high 8 bits (LEDs)*/ > > > > > XGpio_mSetDataReg(XPAR_LED_DEVICE_ID,LEDChan, ~count); > > > > > xil_printf("The value of count = %d\n\r", count); > > > > > > /* Set the number of cycles the timer counts before interrupting */ > > > > > XTmrCtr_mSetLoadReg(XPAR_DELAY_BASEADDR, 0, > > > > > (timer_count*timer_count) * 50000000); > > > > > > /* Reset the timers, and clear interrupts */ > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > > XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK ); > > > > > > /* Enable timer interrupts in the interrupt controller */ > > > > > XIntc_mEnableIntr(XPAR_DELAY_BASEADDR, XPAR_DELAY_INTERRUPT_MASK); > > > > > > /* Start the timers */ > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > > XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | > > > > > XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK); > > > > > > /* Wait for interrupts to occur */ > > > > > while(1) { > > > > > if(one_second_flag){ > > > > > count_mod_3 = count % 3; > > > > > if(count_mod_3 == 0) > > > > > xil_printf("Interrupt taken at %d seconds \n\r",count); > > > > > one_second_flag=0; > > > > > xil_printf("."); > > > > > } > > > > > } > > > > > } > > > > > > When I run the system, the value of count does not change from 1. What > > > > > could be the problem?- Hide quoted text - > > > > > - Show quoted text - > > > Hello, > > > Here is how I set up a timer interrupt in 9.2: > > > void TimerCounterHandler(void *CallBackRef) > > { > > print("timer interrupt "); > > > } > > > Int main (void) { > > > XIntc intr_ctrl; > > XTmrCtr timr; > > > XIntc_Initialize(&intr_ctrl,XPAR_XPS_INTC_0_DEVICE_ID); > > XTmrCtr_Initialize(&timr,XPAR_XPS_TIMER_1_DEVICE_ID); > > > XIntc_Connect(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR, > > (XInterruptHandler) > > XTmrCtr_InterruptHandler, > > (void *)&timr); > > > XIntc_Start(&intr_ctrl, XIN_REAL_MODE); > > > XIntc_Enable(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR); > > > XTmrCtr_SetHandler(&timr, (void *)TimerCounterHandler, void); > > This issued an error so I replaced void with NULL in the third > argument above. Apart from that I didn't change anything, but still > the terminal never printed "timer interrupt" so still the problem > remains!! > > > > > > > XTmrCtr_SetOptions(&timr, 0, > > XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION); > > > XTmrCtr_SetResetValue(&timr, 0, 0xF0000000); > > > XTmrCtr_Start(&timr,0); > > > microblaze_enable_interrupts(); > > > while(1){ > > //wait for interrupts > > } > > > } > > > If you are using the Intc component, you no longer need to use the > > microblaze_register_handler function - instead use the XIntc_Connect() > > function. > > The XTmrCtr driver provides its own interrupt handler > > XTmrCtr_InterruptHandler() which you should use to service the > > interrupt. It will issue a callback to a function of your choice (set > > with XTmrCtr_SetHandler) > > > Hope this helps, > > > David- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
From: bish on 27 Nov 2008 12:08 On Nov 27, 6:14 am, Bryan <bryan.fletc...(a)avnet.com> wrote: > Not sure what the problem is with your code. Here's an example with > one timer. It's 10.1, but there weren't any changes in the interrupt > stuff between 9.2 and 10.1 (so I'm told). This is based on a lab from > one of Avnet's Speedway trainings. I ran it on the Xilinx Spartan-3A > DSP 1800A Starter and verified that the interrupts are indeed > happening. There is a bit file in the project directory if you don't > want to rebuild the project. > > Bryan > > The following file has been made available for you to download from > Avnet's File Transfer web site:http://xfer.avnet.com/uploads/Xil3S1800ADSP_Interrupt_v10.1.03.zip I downloaded the timer_interrupt.bit file into FPGA using impact, the timer example worked FINE. It generated the required output and interrrupt was working. BUT I could not use the system.xmp present in http://xfer.avnet.com/uploads/Xil3S1800ADSP_Interrupt_v10.1.03.zip because I have edk 9.2i, but it was developed with later version of edk. And here is the mysterious problem yet to be solved!! So I developed a base system and used xps interrupt controller and timer. The MHS file is: # ############################################################################## # Created by Base System Builder Wizard for Xilinx EDK 9.2 Build EDK_Jm.16 # Sun Nov 16 21:24:15 2008 # Target Board: Xilinx Spartan-3A DSP 1800A Starter Board Rev 1 # Family: spartan3adsp # Device: xc3sd1800a # Package: fg676 # Speed Grade: -4 # Processor: microblaze_0 # System clock frequency: 62.000000 MHz # On Chip Memory : 8 KB # ############################################################################## PARAMETER VERSION = 2.1.0 PORT fpga_0_RS232_Uart_1_RX_pin = fpga_0_RS232_Uart_1_RX, DIR = I PORT fpga_0_RS232_Uart_1_TX_pin = fpga_0_RS232_Uart_1_TX, DIR = O PORT sys_clk_pin = dcm_clk_s, DIR = I, SIGIS = CLK, CLK_FREQ = 125000000 PORT sys_rst_pin = sys_rst_s, DIR = I, RST_POLARITY = 0, SIGIS = RST PORT dip_GPIO_in_pin = dip_GPIO_in, DIR = I, VEC = [0:7] PORT push_GPIO_in_pin = push_GPIO_in, DIR = I, VEC = [0:3] PORT led_GPIO_IO_pin = led_GPIO_IO, DIR = IO, VEC = [0:7] BEGIN microblaze PARAMETER HW_VER = 7.00.a PARAMETER INSTANCE = microblaze_0 PARAMETER C_INTERCONNECT = 1 PARAMETER C_DEBUG_ENABLED = 1 PARAMETER C_AREA_OPTIMIZED = 1 BUS_INTERFACE DLMB = dlmb BUS_INTERFACE ILMB = ilmb BUS_INTERFACE DPLB = mb_plb BUS_INTERFACE IPLB = mb_plb BUS_INTERFACE DEBUG = microblaze_0_dbg PORT RESET = mb_reset PORT INTERRUPT = Interrupt END BEGIN plb_v46 PARAMETER INSTANCE = mb_plb PARAMETER HW_VER = 1.00.a PORT PLB_Clk = sys_clk_s PORT SYS_Rst = sys_bus_reset END BEGIN lmb_v10 PARAMETER INSTANCE = ilmb PARAMETER HW_VER = 1.00.a PORT LMB_Clk = sys_clk_s PORT SYS_Rst = sys_bus_reset END BEGIN lmb_v10 PARAMETER INSTANCE = dlmb PARAMETER HW_VER = 1.00.a PORT LMB_Clk = sys_clk_s PORT SYS_Rst = sys_bus_reset END BEGIN lmb_bram_if_cntlr PARAMETER INSTANCE = dlmb_cntlr PARAMETER HW_VER = 2.10.a PARAMETER C_BASEADDR = 0x00000000 PARAMETER C_HIGHADDR = 0x00003fff BUS_INTERFACE SLMB = dlmb BUS_INTERFACE BRAM_PORT = dlmb_port END BEGIN lmb_bram_if_cntlr PARAMETER INSTANCE = ilmb_cntlr PARAMETER HW_VER = 2.10.a PARAMETER C_BASEADDR = 0x00000000 PARAMETER C_HIGHADDR = 0x00003fff BUS_INTERFACE SLMB = ilmb BUS_INTERFACE BRAM_PORT = ilmb_port END BEGIN bram_block PARAMETER INSTANCE = lmb_bram PARAMETER HW_VER = 1.00.a BUS_INTERFACE PORTA = ilmb_port BUS_INTERFACE PORTB = dlmb_port END BEGIN xps_uartlite PARAMETER INSTANCE = RS232_Uart_1 PARAMETER HW_VER = 1.00.a PARAMETER C_BAUDRATE = 115200 PARAMETER C_ODD_PARITY = 0 PARAMETER C_USE_PARITY = 0 PARAMETER C_SPLB_CLK_FREQ_HZ = 62500000 PARAMETER C_BASEADDR = 0x84000000 PARAMETER C_HIGHADDR = 0x8400ffff BUS_INTERFACE SPLB = mb_plb PORT RX = fpga_0_RS232_Uart_1_RX PORT TX = fpga_0_RS232_Uart_1_TX END BEGIN clock_generator PARAMETER INSTANCE = clock_generator_0 PARAMETER HW_VER = 1.00.a PARAMETER C_EXT_RESET_HIGH = 1 PARAMETER C_CLKIN_FREQ = 125000000 PARAMETER C_CLKOUT0_FREQ = 62500000 PARAMETER C_CLKOUT0_PHASE = 0 PARAMETER C_CLKOUT0_GROUP = NONE PORT CLKOUT0 = sys_clk_s PORT CLKIN = dcm_clk_s PORT LOCKED = Dcm_all_locked PORT RST = net_gnd END BEGIN mdm PARAMETER INSTANCE = debug_module PARAMETER HW_VER = 1.00.a PARAMETER C_MB_DBG_PORTS = 1 PARAMETER C_USE_UART = 1 PARAMETER C_UART_WIDTH = 8 PARAMETER C_BASEADDR = 0x84400000 PARAMETER C_HIGHADDR = 0x8440ffff BUS_INTERFACE SPLB = mb_plb BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg PORT Debug_SYS_Rst = Debug_SYS_Rst END BEGIN proc_sys_reset PARAMETER INSTANCE = proc_sys_reset_0 PARAMETER HW_VER = 2.00.a PARAMETER C_EXT_RESET_HIGH = 0 PORT Slowest_sync_clk = sys_clk_s PORT Dcm_locked = Dcm_all_locked PORT Ext_Reset_In = sys_rst_s PORT MB_Reset = mb_reset PORT Bus_Struct_Reset = sys_bus_reset PORT MB_Debug_Sys_Rst = Debug_SYS_Rst END BEGIN xps_gpio PARAMETER INSTANCE = push PARAMETER HW_VER = 1.00.a PARAMETER C_GPIO_WIDTH = 4 PARAMETER C_ALL_INPUTS = 1 PARAMETER C_IS_BIDIR = 0 PARAMETER C_BASEADDR = 0x8141c200 PARAMETER C_HIGHADDR = 0x8141c3ff BUS_INTERFACE SPLB = mb_plb PORT GPIO_in = push_GPIO_in END BEGIN xps_gpio PARAMETER INSTANCE = dip PARAMETER HW_VER = 1.00.a PARAMETER C_GPIO_WIDTH = 8 PARAMETER C_ALL_INPUTS = 1 PARAMETER C_IS_BIDIR = 0 PARAMETER C_BASEADDR = 0x81420000 PARAMETER C_HIGHADDR = 0x8142ffff BUS_INTERFACE SPLB = mb_plb PORT GPIO_in = dip_GPIO_in END BEGIN xps_gpio PARAMETER INSTANCE = led PARAMETER HW_VER = 1.00.a PARAMETER C_GPIO_WIDTH = 8 PARAMETER C_IS_BIDIR = 0 PARAMETER C_BASEADDR = 0x81400000 PARAMETER C_HIGHADDR = 0x8140ffff BUS_INTERFACE SPLB = mb_plb PORT GPIO_IO = led_GPIO_IO END BEGIN xps_timer PARAMETER INSTANCE = xps_timer_0 PARAMETER HW_VER = 1.00.a PARAMETER C_BASEADDR = 0x81418000 PARAMETER C_HIGHADDR = 0x814181ff PARAMETER C_ONE_TIMER_ONLY = 1 BUS_INTERFACE SPLB = mb_plb PORT Interrupt = xps_timer_0_Interrupt END BEGIN xps_intc PARAMETER INSTANCE = xps_intc_0 PARAMETER HW_VER = 1.00.a PARAMETER C_BASEADDR = 0x81414000 PARAMETER C_HIGHADDR = 0x814141ff BUS_INTERFACE SPLB = mb_plb PORT Irq = Interrupt PORT Intr = xps_timer_0_Interrupt END In xps_intc I have connected only timer interrupt to its Intr pin and other interrupts like from push buttons and other are NOT CONNECTED. Then I used "timer.c" provided in the link (I have not used external DDR2 SDRAM), and the result: Starting Timer example Timer example FAILED So, I am really confused here!! > > Click on the hyperlink or enter this URL into your web browser to > retrieve the file. > This file will remain on the server for approximately 5 days from the > date of the upload at which time it will be deleted. Please be sure > to download it before the expiration time. > This file will expire on Dec 1, 2008. > > File Size: 232357 Bytes > > On Nov 26, 12:22 am, bish <bishes...(a)gmail.com> wrote: > > > > > On Nov 26, 4:58 am, David <simianfe...(a)gmail.com> wrote: > > > > On Nov 26, 2:37 am, bish <bishes...(a)gmail.com> wrote: > > > > > On Nov 25, 12:25 pm, Matthias Alles <REMOVEallesCAPIT...(a)NOeit.SPAMuni- > > > > > kl.de> wrote: > > > > > Hi! > > > > > > I wonder, whether "one_second_flag" is declared as volatile? If not, the > > > > > compiler optimizes your if-statement in the while(1) loop away. You can > > > > > check this by using mb-objdump. > > > > > I tried using the volatile for one_second_flag, still it does not > > > > work. It just prints "the value of count = 1" once in terminal and > > > > nothing happens then. > > > > > > Cheers, > > > > > Matthias > > > > > > bish schrieb: > > > > > > > I am trying to use a timer for regular interrupt in microblaze. I am > > > > > > using edk 9.2i and spartan 3a dsp 1800a. > > > > > > Even following a simple lab example widely used by beginners didn't > > > > > > work:http://users.utcluj.ro/~baruch/ssce/labor/EDK-L5-e.pdf > > > > > > > I have connected all the interrupt ports correctly as evident from the > > > > > > following portion of the mhs file: > > > > > > BEGIN microblaze > > > > > > PARAMETER HW_VER = 7.00.a > > > > > > ........... > > > > > > ........... > > > > > > PORT INTERRUPT = interrupt > > > > > > END > > > > > > > BEGIN xps_timer > > > > > > PARAMETER INSTANCE = delay > > > > > > PARAMETER HW_VER = 1.00.a > > > > > > PARAMETER C_ONE_TIMER_ONLY = 1 > > > > > > PARAMETER C_BASEADDR = 0x8141c200 > > > > > > PARAMETER C_HIGHADDR = 0x8141c3ff > > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > > PORT Interrupt = timer1 > > > > > > PORT CaptureTrig0 = net_gnd > > > > > > END > > > > > > > BEGIN xps_intc > > > > > > PARAMETER INSTANCE = xps_intc_0 > > > > > > PARAMETER HW_VER = 1.00.a > > > > > > PARAMETER C_BASEADDR = 0x81418000 > > > > > > PARAMETER C_HIGHADDR = 0x814181ff > > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > > PORT Irq = interrupt > > > > > > PORT Intr = timer1 > > > > > > END > > > > > > > Now for the software settings since I am using edk 9.2i, it does not > > > > > > have option for registering our interrupt handler in software platform > > > > > > settings window (which is what the lab suggests), I used the > > > > > > microblaze_register_handler(...) function ( I took me 3 days to figure > > > > > > out this), but I still don't get how it works differently from the > > > > > > function XIntc_RegisterHandler. > > > > > > The portion of C file is as follows: > > > > > > void timer_int_handler(void * baseaddr_p) { > > > > > > /* Add variable declarations here */ > > > > > > unsigned int csr; > > > > > > /* Read timer 0 CSR to see if it raised the interrupt */ > > > > > > csr = XTmrCtr_mGetControlStatusReg(XPAR_DELAY_BASEADDR,0); > > > > > > /* If the interrupt occurred, then increment a counter */ > > > > > > /* and set one_second_flag to 1 */ > > > > > > if (csr & XTC_CSR_INT_OCCURED_MASK ) { > > > > > > count ++; > > > > > > one_second_flag = 1; > > > > > > } > > > > > > > /* Display the count on the LEDs */ > > > > > > XGpio_mSetDataReg(XPAR_LED_HIGHADDR, LEDChan, count); > > > > > > > /* Print the count using the UART*/ > > > > > > xil_printf("count value is: %x\n\r", count); > > > > > > /* Clear the timer interrupt */ > > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR,0,csr); > > > > > > } > > > > > > > int main() { > > > > > > > int count_mod_3; > > > > > > > //registering an interrupt handler > > > > > > microblaze_register_handler((XInterruptHandler) timer_int_handler, > > > > > > (void *)0); > > > > > > > /* Register the Timer interrupt handler in the vector table */ > > > > > > XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR, > > > > > > XPAR_XPS_INTC_0_DELAY_INTERRUPT_INTR, > > > > > > (XInterruptHandler) timer_int_handler, > > > > > > (void *)XPAR_DELAY_BASEADDR); > > > > > > /* Enable MicroBlaze Interrupts */ > > > > > > microblaze_enable_interrupts(); > > > > > > > /* Initialize and set the direction of the GPIO connected to LEDs */ > > > > > > XGpio_Initialize(&gpio, XPAR_LED_DEVICE_ID); > > > > > > XGpio_SetDataDirection(&gpio,LEDChan, 0); > > > > > > > /* Start the interrupt controller */ > > > > > > XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR); > > > > > > XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, 0x1); > > > > > > > /* Set the gpio as output on high 8 bits (LEDs)*/ > > > > > > XGpio_mSetDataReg(XPAR_LED_DEVICE_ID,LEDChan, ~count); > > > > > > xil_printf("The value of count = %d\n\r", count); > > > > > > > /* Set the number of cycles the timer counts before interrupting */ > > > > > > XTmrCtr_mSetLoadReg(XPAR_DELAY_BASEADDR, 0, > > > > > > (timer_count*timer_count) * 50000000); > > > > > > > /* Reset the timers, and clear interrupts */ > > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > > > XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK ); > > > > > > > /* Enable timer interrupts in the interrupt controller */ > > > > > > XIntc_mEnableIntr(XPAR_DELAY_BASEADDR, XPAR_DELAY_INTERRUPT_MASK); > > > > > > > /* Start the timers */ > > > > > > XTmrCtr_mSetControlStatusReg(XPAR_DELAY_BASEADDR, 0, > > > > > > XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | > > > > > > XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK); > > > > > > > /* Wait for interrupts to occur */ > > > > > > while(1) { > > > > > > if(one_second_flag){ > > > > > > count_mod_3 = count % 3; > > > > > > if(count_mod_3 == 0) > > > > > > xil_printf("Interrupt taken at %d seconds \n\r",count); > > > > > > one_second_flag=0; > > > > > > xil_printf("."); > > > > > > } > > > > > > } > > > > > > } > > > > > > > When I run the system, the value of count does not change from 1. What > > > > > > could be the problem?- Hide quoted text - > > > > > > - Show quoted text - > > > > Hello, > > > > Here is how I set up a timer interrupt in 9.2: > > > > void TimerCounterHandler(void *CallBackRef) > > > { > > > print("timer interrupt "); > > > > } > > > > Int main (void) { > > > > XIntc intr_ctrl; > > > XTmrCtr timr; > > > > XIntc_Initialize(&intr_ctrl,XPAR_XPS_INTC_0_DEVICE_ID); > > > XTmrCtr_Initialize(&timr,XPAR_XPS_TIMER_1_DEVICE_ID); > > > > XIntc_Connect(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR, > > > (XInterruptHandler) > > > XTmrCtr_InterruptHandler, > > > (void *)&timr); > > > > XIntc_Start(&intr_ctrl, XIN_REAL_MODE); > > > > XIntc_Enable(&intr_ctrl, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR); > > > > XTmrCtr_SetHandler(&timr, (void *)TimerCounterHandler, void); > > > This issued an error so I replaced void with NULL in the third > > argument above. Apart from that I didn't change anything, but still > > the terminal never printed "timer interrupt" so still the problem > > remains!! > > > > XTmrCtr_SetOptions(&timr, 0, > > > XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION); > > > > XTmrCtr_SetResetValue(&timr, 0, 0xF0000000); > > > > XTmrCtr_Start(&timr,0); > > > > microblaze_enable_interrupts(); > > > > while(1){ > > > //wait for interrupts > > > } > > > > } > > > > If you are using the Intc component, you no longer need to use the > > > microblaze_register_handler function - instead use the XIntc_Connect() > > > function. > > > The XTmrCtr driver provides its own interrupt handler > > > XTmrCtr_InterruptHandler() which you should use to service the > > > interrupt. It will issue a callback to a function of your choice (set > > > with XTmrCtr_SetHandler) > > > > Hope this helps, > > > > David- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
From: bish on 27 Nov 2008 12:24 On Nov 27, 10:08 pm, bish <bishes...(a)gmail.com> wrote: > On Nov 27, 6:14 am, Bryan <bryan.fletc...(a)avnet.com> wrote: > > > Not sure what the problem is with your code. Here's an example with > > one timer. It's 10.1, but there weren't any changes in the interrupt > > stuff between 9.2 and 10.1 (so I'm told). This is based on a lab from > > one of Avnet's Speedway trainings. I ran it on the Xilinx Spartan-3A > > DSP 1800A Starter and verified that the interrupts are indeed > > happening. There is a bit file in the project directory if you don't > > want to rebuild the project. > > > Bryan > > > The following file has been made available for you to download from > > Avnet's File Transfer web site:http://xfer.avnet.com/uploads/Xil3S1800ADSP_Interrupt_v10.1.03.zip > > I downloaded the timer_interrupt.bit file into FPGA using impact, the > timer example worked FINE. > It generated the required output and interrrupt was working. BUT > > I could not use the system.xmp present inhttp://xfer.avnet.com/uploads/Xil3S1800ADSP_Interrupt_v10.1.03.zip > because > I have edk 9.2i, but it was developed with later version of edk. > > And here is the mysterious problem yet to be solved!! > So I developed a base system and used xps interrupt controller and > timer. The MHS file is: > > # > ############################################################################## > # Created by Base System Builder Wizard for Xilinx EDK 9.2 Build > EDK_Jm.16 > # Sun Nov 16 21:24:15 2008 > # Target Board: Xilinx Spartan-3A DSP 1800A Starter Board Rev 1 > # Family: spartan3adsp > # Device: xc3sd1800a > # Package: fg676 > # Speed Grade: -4 > # Processor: microblaze_0 > # System clock frequency: 62.000000 MHz > # On Chip Memory : 8 KB > # > ############################################################################## > PARAMETER VERSION = 2.1.0 > > PORT fpga_0_RS232_Uart_1_RX_pin = fpga_0_RS232_Uart_1_RX, DIR = I > PORT fpga_0_RS232_Uart_1_TX_pin = fpga_0_RS232_Uart_1_TX, DIR = O > PORT sys_clk_pin = dcm_clk_s, DIR = I, SIGIS = CLK, CLK_FREQ = > 125000000 > PORT sys_rst_pin = sys_rst_s, DIR = I, RST_POLARITY = 0, SIGIS = RST > PORT dip_GPIO_in_pin = dip_GPIO_in, DIR = I, VEC = [0:7] > PORT push_GPIO_in_pin = push_GPIO_in, DIR = I, VEC = [0:3] > PORT led_GPIO_IO_pin = led_GPIO_IO, DIR = IO, VEC = [0:7] > > BEGIN microblaze > PARAMETER HW_VER = 7.00.a > PARAMETER INSTANCE = microblaze_0 > PARAMETER C_INTERCONNECT = 1 > PARAMETER C_DEBUG_ENABLED = 1 > PARAMETER C_AREA_OPTIMIZED = 1 > BUS_INTERFACE DLMB = dlmb > BUS_INTERFACE ILMB = ilmb > BUS_INTERFACE DPLB = mb_plb > BUS_INTERFACE IPLB = mb_plb > BUS_INTERFACE DEBUG = microblaze_0_dbg > PORT RESET = mb_reset > PORT INTERRUPT = Interrupt > END > > BEGIN plb_v46 > PARAMETER INSTANCE = mb_plb > PARAMETER HW_VER = 1.00.a > PORT PLB_Clk = sys_clk_s > PORT SYS_Rst = sys_bus_reset > END > > BEGIN lmb_v10 > PARAMETER INSTANCE = ilmb > PARAMETER HW_VER = 1.00.a > PORT LMB_Clk = sys_clk_s > PORT SYS_Rst = sys_bus_reset > END > > BEGIN lmb_v10 > PARAMETER INSTANCE = dlmb > PARAMETER HW_VER = 1.00.a > PORT LMB_Clk = sys_clk_s > PORT SYS_Rst = sys_bus_reset > END > > BEGIN lmb_bram_if_cntlr > PARAMETER INSTANCE = dlmb_cntlr > PARAMETER HW_VER = 2.10.a > PARAMETER C_BASEADDR = 0x00000000 > PARAMETER C_HIGHADDR = 0x00003fff > BUS_INTERFACE SLMB = dlmb > BUS_INTERFACE BRAM_PORT = dlmb_port > END > > BEGIN lmb_bram_if_cntlr > PARAMETER INSTANCE = ilmb_cntlr > PARAMETER HW_VER = 2.10.a > PARAMETER C_BASEADDR = 0x00000000 > PARAMETER C_HIGHADDR = 0x00003fff > BUS_INTERFACE SLMB = ilmb > BUS_INTERFACE BRAM_PORT = ilmb_port > END > > BEGIN bram_block > PARAMETER INSTANCE = lmb_bram > PARAMETER HW_VER = 1.00.a > BUS_INTERFACE PORTA = ilmb_port > BUS_INTERFACE PORTB = dlmb_port > END > > BEGIN xps_uartlite > PARAMETER INSTANCE = RS232_Uart_1 > PARAMETER HW_VER = 1.00.a > PARAMETER C_BAUDRATE = 115200 > PARAMETER C_ODD_PARITY = 0 > PARAMETER C_USE_PARITY = 0 > PARAMETER C_SPLB_CLK_FREQ_HZ = 62500000 > PARAMETER C_BASEADDR = 0x84000000 > PARAMETER C_HIGHADDR = 0x8400ffff > BUS_INTERFACE SPLB = mb_plb > PORT RX = fpga_0_RS232_Uart_1_RX > PORT TX = fpga_0_RS232_Uart_1_TX > END > > BEGIN clock_generator > PARAMETER INSTANCE = clock_generator_0 > PARAMETER HW_VER = 1.00.a > PARAMETER C_EXT_RESET_HIGH = 1 > PARAMETER C_CLKIN_FREQ = 125000000 > PARAMETER C_CLKOUT0_FREQ = 62500000 > PARAMETER C_CLKOUT0_PHASE = 0 > PARAMETER C_CLKOUT0_GROUP = NONE > PORT CLKOUT0 = sys_clk_s > PORT CLKIN = dcm_clk_s > PORT LOCKED = Dcm_all_locked > PORT RST = net_gnd > END > > BEGIN mdm > PARAMETER INSTANCE = debug_module > PARAMETER HW_VER = 1.00.a > PARAMETER C_MB_DBG_PORTS = 1 > PARAMETER C_USE_UART = 1 > PARAMETER C_UART_WIDTH = 8 > PARAMETER C_BASEADDR = 0x84400000 > PARAMETER C_HIGHADDR = 0x8440ffff > BUS_INTERFACE SPLB = mb_plb > BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg > PORT Debug_SYS_Rst = Debug_SYS_Rst > END > > BEGIN proc_sys_reset > PARAMETER INSTANCE = proc_sys_reset_0 > PARAMETER HW_VER = 2.00.a > PARAMETER C_EXT_RESET_HIGH = 0 > PORT Slowest_sync_clk = sys_clk_s > PORT Dcm_locked = Dcm_all_locked > PORT Ext_Reset_In = sys_rst_s > PORT MB_Reset = mb_reset > PORT Bus_Struct_Reset = sys_bus_reset > PORT MB_Debug_Sys_Rst = Debug_SYS_Rst > END > > BEGIN xps_gpio > PARAMETER INSTANCE = push > PARAMETER HW_VER = 1.00.a > PARAMETER C_GPIO_WIDTH = 4 > PARAMETER C_ALL_INPUTS = 1 > PARAMETER C_IS_BIDIR = 0 > PARAMETER C_BASEADDR = 0x8141c200 > PARAMETER C_HIGHADDR = 0x8141c3ff > BUS_INTERFACE SPLB = mb_plb > PORT GPIO_in = push_GPIO_in > END > > BEGIN xps_gpio > PARAMETER INSTANCE = dip > PARAMETER HW_VER = 1.00.a > PARAMETER C_GPIO_WIDTH = 8 > PARAMETER C_ALL_INPUTS = 1 > PARAMETER C_IS_BIDIR = 0 > PARAMETER C_BASEADDR = 0x81420000 > PARAMETER C_HIGHADDR = 0x8142ffff > BUS_INTERFACE SPLB = mb_plb > PORT GPIO_in = dip_GPIO_in > END > > BEGIN xps_gpio > PARAMETER INSTANCE = led > PARAMETER HW_VER = 1.00.a > PARAMETER C_GPIO_WIDTH = 8 > PARAMETER C_IS_BIDIR = 0 > PARAMETER C_BASEADDR = 0x81400000 > PARAMETER C_HIGHADDR = 0x8140ffff > BUS_INTERFACE SPLB = mb_plb > PORT GPIO_IO = led_GPIO_IO > END > > BEGIN xps_timer > PARAMETER INSTANCE = xps_timer_0 > PARAMETER HW_VER = 1.00.a > PARAMETER C_BASEADDR = 0x81418000 > PARAMETER C_HIGHADDR = 0x814181ff > PARAMETER C_ONE_TIMER_ONLY = 1 > BUS_INTERFACE SPLB = mb_plb > PORT Interrupt = xps_timer_0_Interrupt > END > > BEGIN xps_intc > PARAMETER INSTANCE = xps_intc_0 > PARAMETER HW_VER = 1.00.a > PARAMETER C_BASEADDR = 0x81414000 > PARAMETER C_HIGHADDR = 0x814141ff > BUS_INTERFACE SPLB = mb_plb > PORT Irq = Interrupt > PORT Intr = xps_timer_0_Interrupt > END > > In xps_intc I have connected only timer interrupt to its Intr pin and > other interrupts like > from push buttons and other are NOT CONNECTED. In the configure ip.. option for xps interrupt controller I could not change the no. of interrupt inputs (by default it is 2), as it is set to 2 and disabled. So I used two timers and connected interrupt pins of these timers to interrupt controller just make intr inputs 2. Then again I checked with the "timer.c" file from the link, and still the same result: Timer example failed !!! This has already taken so many days and problem is becoming more mysterious (but frustrating)!!! > Then I used "timer.c" provided in the link (I have not used external > DDR2 SDRAM), and the result: > > Starting Timer example > Timer example FAILED > > So, I am really confused here!! > > > > > > > Click on the hyperlink or enter this URL into your web browser to > > retrieve the file. > > This file will remain on the server for approximately 5 days from the > > date of the upload at which time it will be deleted. Please be sure > > to download it before the expiration time. > > This file will expire on Dec 1, 2008. > > > File Size: 232357 Bytes > > > On Nov 26, 12:22 am, bish <bishes...(a)gmail.com> wrote: > > > > On Nov 26, 4:58 am, David <simianfe...(a)gmail.com> wrote: > > > > > On Nov 26, 2:37 am, bish <bishes...(a)gmail.com> wrote: > > > > > > On Nov 25, 12:25 pm, Matthias Alles <REMOVEallesCAPIT...(a)NOeit.SPAMuni- > > > > > > kl.de> wrote: > > > > > > Hi! > > > > > > > I wonder, whether "one_second_flag" is declared as volatile? If not, the > > > > > > compiler optimizes your if-statement in the while(1) loop away. You can > > > > > > check this by using mb-objdump. > > > > > > I tried using the volatile for one_second_flag, still it does not > > > > > work. It just prints "the value of count = 1" once in terminal and > > > > > nothing happens then. > > > > > > > Cheers, > > > > > > Matthias > > > > > > > bish schrieb: > > > > > > > > I am trying to use a timer for regular interrupt in microblaze. I am > > > > > > > using edk 9.2i and spartan 3a dsp 1800a. > > > > > > > Even following a simple lab example widely used by beginners didn't > > > > > > > work:http://users.utcluj.ro/~baruch/ssce/labor/EDK-L5-e.pdf > > > > > > > > I have connected all the interrupt ports correctly as evident from the > > > > > > > following portion of the mhs file: > > > > > > > BEGIN microblaze > > > > > > > PARAMETER HW_VER = 7.00.a > > > > > > > ........... > > > > > > > ........... > > > > > > > PORT INTERRUPT = interrupt > > > > > > > END > > > > > > > > BEGIN xps_timer > > > > > > > PARAMETER INSTANCE = delay > > > > > > > PARAMETER HW_VER = 1.00.a > > > > > > > PARAMETER C_ONE_TIMER_ONLY = 1 > > > > > > > PARAMETER C_BASEADDR = 0x8141c200 > > > > > > > PARAMETER C_HIGHADDR = 0x8141c3ff > > > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > > > PORT Interrupt = timer1 > > > > > > > PORT CaptureTrig0 = net_gnd > > > > > > > END > > > > > > > > BEGIN xps_intc > > > > > > > PARAMETER INSTANCE = xps_intc_0 > > > > > > > PARAMETER HW_VER = 1.00.a > > > > > > > PARAMETER C_BASEADDR = 0x81418000 > > > > > > > PARAMETER C_HIGHADDR = 0x814181ff > > > > > > > BUS_INTERFACE SPLB = mb_plb > > > > > > > PORT Irq = interrupt > > > > > > > PORT Intr = timer1 > > > > > > > END > > > > > > > > Now for the software settings since I am using edk 9.2i, it does not > > > > > > > have option for registering our interrupt handler in software platform > > > > > > > settings window (which is what the lab suggests), I used the > > > > > > > microblaze_register_handler(...) function ( I took me 3 days to figure > > > > > > > out this), but I still don't get how it works differently from the > > > > > > > function XIntc_RegisterHandler. > > > > > > > The portion of C file is as follows: > > > > > > > void timer_int_handler(void * baseaddr_p) { > > > > > > > /* Add variable declarations here */ > > > > > > > unsigned int csr; > > > > > > > /* Read timer 0 CSR to see if it raised the interrupt */ > > > > > > > csr = XTmrCtr_mGetControlStatusReg(XPAR_DELAY_BASEADDR,0); > > > > > > > /* If the interrupt occurred, then increment a counter */ > > > > > > > /* and set one_second_flag to 1 */ > > > > > > > if (csr & XTC_CSR_INT_OCCURED_MASK ) { > > ... > > read more »- Hide quoted text - > > - Show quoted text -
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: how to display on LCD of FPGA board? Next: Use Chipscope libCseJtag.dll |