Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: k66 ethernet rx interrupt

  1. #1
    Member
    Join Date
    Jul 2016
    Location
    Denmark
    Posts
    25

    Teensy 3.6 ethernet rx interrupt

    Hello
    I have trouble getting the k66 ethernet rx interrupt to trigger.

    i am activating the interrupt and interrupt mask:
    Code:
    ENET_EIR = ENET_EIR_RXF;
    ENET_EIR = ENET_EIR_RXB;
    ENET_EIMR = ENET_EIRM_RXF | ENET_EIRM_RXB;
    the ring buffer is set to allow interrupt:
    Code:
    for (int i=0; i < RXSIZE; i++) {
        rx_ring[i].flags.all = 0x8000; // empty flag
        rx_ring[i].moreflags.all = 0x80; // set Interrupt true
        rx_ring[i].buffer = rxbufs + i * 128;
    }
    the interrupt function is set:
    Code:
    void rxIRQ(void){
      Serial.println("........Interrupt........");
      interruptFlag++;
      ENET_EIR = ENET_EIR_RXF;
      ENET_EIR = ENET_EIR_RXB;
    }
    and the interrupt vector i activated:
    Code:
    attachInterruptVector(IRQ_ENET_RX, rxIRQ);
    NVIC_IS_ACTIVE(IRQ_ENET_RX);
    NVIC_ENABLE_IRQ(IRQ_ENET_RX);
    __enable_irq();
    this triggers no interrupts....

    NVIC_TRIGGER_IRQ(IRQ_ENET_RX); will trigger a interrupt

    and replacing IRQ_ENET_RX with IRQ_ENET_ERROR
    you get a interrupt befor every mdio_read


    source: https://github.com/alex-Arc/k66_ethernet/tree/interrupt
    Last edited by alex-arc; 04-18-2017 at 05:21 PM. Reason: better title

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,005
    i have rx and tx interrupts enabled in the following sketch (i just count packets in and out)
    https://github.com/manitou48/teensy3...r/etherraw.ino

    discussion at https://forum.pjrc.com/threads/34808...l=1#post109161

  3. #3
    Member
    Join Date
    Jul 2016
    Location
    Denmark
    Posts
    25
    Thank you.

    i had the flag wrong
    rx_ring[i].moreflags.all = 0x80;
    should be
    rx_ring[i].moreflags.all = 0x8000;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •