I only get one ENET receive interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I only get one ENET receive interrupt

Jump to solution
1,331 Views
danielnäslund
Contributor III

I have a MPC5748g dev board.

 

I can set a breakpoint in the my ENET_1_ISR and it gets triggered when I receive a packet. But only once.

 

Can you see any obvious problems in how I manage the buffers and acknowledge the interrupt? See the attached EthernetInterface.{cpp,h} file. Sorry about not posting the whole project. I'll try creating a new project that don't includes any company dependencies and post it in a follow-up, if no one spots any obvious bugs.

 

void InitRxInterrupts()
{
     INTC.PSR[211].B.PRC_SELN = 0x8; // IRQ sent to core 0.
     INTC.PSR[211].B.PRIN = 10; // IRQ priority = 10, (15 is highest)

     // Enable the generation of Rx frame interrupts.
    ENET.EIMR.B.RXF = 1;

    // Indicate Empty buffers have been produced
     ENET.RDAR.B.RDAR = 1;
}

extern "C" void ENET_1_ISR()
{
     eNBUF *bd = GetActiveRxBD();

    MarkRxBDEmpty(bd);

    // Flag that descriptors are available to allow reception
     ENET.RDAR.B.RDAR = 1;

    // Clear interrupt
     ENET.EIR.B.RXF = 1;

    //To check if receiver is working or not....
     //If receiver handler exists successfully then LED will toggle at each receive event
     static int flag = 0;
     if(flag==0)
     {
         SIUL2.MSCR[Pad(PG, 2)].B.OBE = 1;
         flag=1;
     }
     else
     {
         SIUL2.MSCR[Pad(PG, 2)].B.OBE = 0;
         flag=0;
     }
}

Original Attachment has been moved to: EthernetInterface.h.zip

Original Attachment has been moved to: EthernetInterface.cpp.zip

Labels (1)
Tags (1)
0 Kudos
1 Solution
784 Views
danielnäslund
Contributor III

Problem fixed. I needed to set the interrupt flag in the eNBUF's status8 field, every time I left the ISR.

buf->status0 = RX_BD_S0_E;
buf->status8 = RX_BD_S8_INT;   // The fix
buf->statusA = 0;
buf->statusC = 0;
buf->statusE = 0;
buf->status10 = 0;
buf->length = 0;

View solution in original post

1 Reply
785 Views
danielnäslund
Contributor III

Problem fixed. I needed to set the interrupt flag in the eNBUF's status8 field, every time I left the ISR.

buf->status0 = RX_BD_S0_E;
buf->status8 = RX_BD_S8_INT;   // The fix
buf->statusA = 0;
buf->statusC = 0;
buf->statusE = 0;
buf->status10 = 0;
buf->length = 0;