Hey Mark,
Thanks for the feedback.
After the Auto-Negotiation is finished (Register 1 – Bit 5 is set), I’m reading the result of the Auto-Negotiation. Sadly this is non-Standard. In case of the DM9161A-Phy it is Register17 – Bit 12-15.
OperationMode GetOperationMode_DM9161A (void)
{
/*17.15 - 100FDX - 100M Full Duplex Operation Mode
17.14 - 100HDX - 100M Half Duplex Operation Mode 17.13 - 10FDX - 10M Full Duplex Operation Mode 17.12 - 10HDX - 10M Half Duplex Operation Mode 17.3-17.0 - Auto-negotiation Monitor Bits 1 0 0 0 --> Auto-negotiation completed successfully */ |
static const uint16_t OperationModeMask = 0xF000;
static const uint16_t OperationModeShift = 12;
static const uint16_t AutoNegotiationComplete_Mask = 0x04;
uint16_t DSCSR = 0;
if (!this->pMII->Read (this->Address, 17, DSCSR))
return UnknownMode;
if (DSCSR & AutoNegotiationComplete_Mask)
return OM_AutoNegotiation;
switch ((DSCSR & OperationModeMask) >> OperationModeShift)
{
case 1: return 10BaseT_HD;
case 2: return 10BaseT_FD;
case 4: return 100BaseTX_HD;
case 8: return 100BaseTX_FD;
default:return UnknownMode;
}
}
With the Result of this function I’m setting the corresponding Flags in RCR and TCR.
if (OperationMode ==100BaseTX_FD || OperationMode == 10BaseT_FD)
{
// Full duplex
ENET->RCR &= ~ENET_RCR_DRT_MASK;
ENET->TCR |= ENET_TCR_FDEN_MASK;
}
else
{
// half duplex
ENET->RCR |= ENET_RCR_DRT_MASK;
ENET->TCR &= (uint32_t)~ENET_TCR_FDEN_MASK;
}
// Setup speed
if (OperationMode == 10BaseT_FD || OperationMode == 10BaseT_HD)
ENET->RCR |= ENET_RCR_RMII_10T_MASK; // 10Mbps
As I said. This is working perfectly fine for the K60FX512 with DM9161A. Stepping through the code with the two other systems looks also good. I’m getting a link and can read the Operation Mode. But I can’t see any packet which is transferred. And no RX/TX/Error interrupt occurs.
Are there any differences in the EMAC implementation of the different Kinetis-Controllers I have to face with? Are there any differences in the RMII/MII usage I should handle? Do I have to handle the Phys in a different way? The Registers 0-F are covered by IEEE 802.3 Section 2. The only non-Standard-Register I’m using is the one to get the Auto-Negotiation-Result.
Thanks and Regards
Markus
PS: The Jumper on the tower look correct