Altera_Forum
Honored Contributor
14 years agointerrupt handling
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