- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear experts,
I am Nios beginner. I wonder why I cannot reset the edge capture register using IOWR_ALTERA_AVALON_PIO_EDGE_CAP (to reset it inside my ISR)? //after first interrupt, edge capture register became 1 and remain 1 no matter how many time I reset it using IOWR_ALTERA_AVALON_PIO_EDGE_CAP pio_cnt=IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_BASE); alt_printf("pio_cnt= %x \n", pio_cnt); // pio_cnt=1 IOWR_ALTERA_AVALON_PIO_EDGE_CAP (PIO_BASE,0); //try to reset to zero pio_cnt=IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_BASE); alt_printf("pio_cnt= %x \n", pio_cnt); // still pio_cnt=1 !!!! I configured my PIO as (Input, Synchronous Falling Edge capture, Enable bit-clearing for edge capture register, Generate IRQ with edge trigger) using SOPC builder 10.1. Your advice is highly appreciated. Thank you in advance. SkwLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi skw
In order to reset the edge capture register you must write one to the bits you want to reset, not write zero into the register. Then, this line IOWR_ALTERA_AVALON_PIO_EDGE_CAP (PIO_BASE,0); must be changed in IOWR_ALTERA_AVALON_PIO_EDGE_CAP (PIO_BASE, IRQ_BIT_MASK); For example, if your irq signal is connected to pio bit 5, you'll define IRQ_BIT_MASK = 0x40 Regards- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Cris72,
Thanks a lot. My board worked after the change. Best regards, Skw- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's incredible! The same code with the same error is generated by Nios II SBT for Eclipse in the count_binary sample, that writes:
IOWR_ALTERA_AVALON_PIO_EDGE_CAP (BUTTON_PIO_BASE,0); writting '0' instead '1'... I was one day looking for the error and debugging the program before coming to these fora, when I finally found the solution. Why the sample code is wrong? Additionally, I have problems writting the display with the code generated by the system... I will look again in the forum to see if this is due again to errors in it... Regards, Antonio- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the option Enable bit-clearing for edge capture register is turned off, writing any value to
the edgecapture register clears all bits in the register. Otherwise, writing a 1 to a particular bit in the register clears only that bit. https://www.alteraforum.com/forum/attachment.php?attachmentid=11355
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