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++
Announcements
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.

interrupt handling

Altera_Forum
Honored Contributor II
876 Views

Hello There, 

 

using below peace of code i am trying to read external 8 bit data from DATA_IN bus.during edge_capture interrupt arrive, though it read almost all data but it miss 2-3 data during reading. 

 

LPKtCount = 178  

PktSize = 1472 

 

if(edge_capture) 

edge_capture = 0; //reset interrupt 

imgbuff[lpktcount][count++] = iord_altera_avalon_pio_data(data_in_base); 

 

if(count == pktsize) //check end of packet-data -->1472 

count = 0; //point to start of packet data 

lpktcount++; //increment packet count 

} 

 

//------------------------------------------------------------------------- 

ImgBuff[MaxPacket][PktSize] is a two dimentional array which hold the Incomind data (8 bit). Writing data in Array only during Edge_capture Interrupt arrive (LOAD). 

 

Every time edge_capture interrupt get high it load the data from external sybc_detct and write in to two dimentional array. But some time it misse the data and read next data. 

(for sake simplicity i have give count sequence as a input data) 

 

As shown in print screen of output highlighted part, where 39 is the Address and 40 is the data. This position 39:40 is not a fix position next time it miss some different value. 

 

Address is locally generated counter but reading data from external sync_detect (from 8 bit bus). 

 

7. I have seen (On Logic Analyzer) that external sync _detect gives proper data mean it is not missing any data. Please suggest Guide where went wrong in my code. 

 

I have assign highest priority to this load pulse. 

 

Please see PrintScreen of  

1. Hardware (Nios-II and Sync_Detect) 

2. Software Output (Highleted) 

 

 

regards 

 

kaushal kanwariya
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
109 Views

One possibility is that your input signal is changing too fast for the CPU. Handling an interrupt takes many cycles. If you want to be sure not to miss any data you should create a handshake mechanism, or provide your data through an Avalon Stream interface and read it with a DMA.

Altera_Forum
Honored Contributor II
109 Views

 

--- Quote Start ---  

One possibility is that your input signal is changing too fast for the CPU. Handling an interrupt takes many cycles. If you want to be sure not to miss any data you should create a handshake mechanism, or provide your data through an Avalon Stream interface and read it with a DMA. 

--- Quote End ---  

 

 

Thanking you for reply. 

 

will try this out. 

 

kaushal
Reply