Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: AT91SAM7X-EK problem: not receiving PHY interrupt
PostPosted: Thu Jun 28, 2007 4:51 am 
Offline

Joined: Thu Jun 28, 2007 4:40 am
Posts: 9
Location: San Diego, CA
I cannot get the PHY link-change interrupt to assert. I have the driver running, and I can see that the bits change in the MII_INTR register, and the MDINTR bit in the register gets set, but there doesn't appear to be anything happening on the PB26 pin (according to PIO_PDSR).

Anyone gotten this to work? Here is my init code, distilled to the important parts...
Code:
#define MII_INTR 21   /// interrupt register on PHY
#define MII_INTR_ENABLE_ALL 0  /// Set all the bits to 0
#define MII_INTERRUPT_PIN  AT91C_PIO_PB26

static void phy_install_interrupt(void) {
    // Enable the interrupts in the MII register
    AT91C_BASE_EMAC->EMAC_NCR |= AT91C_EMAC_MPE;
    phy_write(MII_INTR,MII_INTR_ENABLE_ALL);
    AT91C_BASE_EMAC->EMAC_NCR &= ~AT91C_EMAC_MPE;

    // Configure the pin to be an input source
    AT91C_BASE_PIOB->PIO_ODR = MII_INTERRUPT_PIN;   // Make it an input
    AT91C_BASE_PIOB->PIO_IFDR = MII_INTERRUPT_PIN;   // Disable the input glitch filter (could enable it, but we'll try this for now)
    AT91C_BASE_PIOB->PIO_PER = MII_INTERRUPT_PIN;   // Make it a GPIO pin

   /* ...Set up the interrupt vector... */
    AT91C_BASE_AIC->AIC_SVR[AT91C_ID_PIOB] = (AT91_REG) &sam7xek_piob_handler;
    AT91C_BASE_AIC->AIC_SMR[AT91C_ID_PIOB] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | (AT91C_AIC_PRIOR && (3<<0));
    AT91C_BASE_AIC->AIC_ICCR = (1 << AT91C_ID_PIOB);
    AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_PIOB);

    /* Enable an interrupt based on that pin */
    AT91C_BASE_PIOB->PIO_IER = MII_INTERRUPT_PIN;   // Enable the interrupt
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 8:15 pm 
Offline

Joined: Thu Jun 28, 2007 4:40 am
Posts: 9
Location: San Diego, CA
Alright, the pin now works. I made the following changes:

* Enable PIOB clock via PMC_PCER. Otherwise, there is no sampling on the input pin.
* Need to drive PB0 low when you reset the PHY. This is latched in as ISOLATE, which I was writing back to 0 later, but evidently it needed to be driven low. That makes 4 pins I had to drive low when I reset the PHY in order to get it to work: ISOLATE, TESTMODE, COL, RMII.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: