Hello,
I'm using LPC1788 with KSZ8051 PHY and some strange things are happening.
Most part of the time the communication works ok, but sometimes a packet written to EMAC is not transmitted.
At least 1 packet in 100 is lost and have to be retransmitted.
Does anyone have a clue about it?
My source code for transmitting :
void WriteData_EMAC(void *Source, unsigned int Size) { unsigned int idx; unsigned short * piSource; unsigned short *txptr;
__set_PRIMASK(1);
idx = LPC_EMAC->TxProduceIndex; txptr = (unsigned short *)TX_DESC_PACKET(idx);
TX_DESC_CTRL(idx) = Size | TCTRL_LAST | TCTRL_INT;
piSource = Source; Size = (Size + 1) & 0xFFFE; // round Size up to next even number
while (Size > 0) { *txptr++ = *piSource++; Size -= 2; }
if (++idx == NUM_TX_FRAG) idx = 0;
while( idx == LPC_EMAC->TxConsumeIndex );
LPC_EMAC->TxProduceIndex = idx;
__set_PRIMASK(0);
}
Thankyou!
Hi,
I had exactly the same problem using LPC1778 where about 3% of the packages went wrong. That is in MII mode. Now NXP admitted that there is a bug with that in the processor itself.
Yesterday I changed the mode to Reduced MII (RMII) and did a test overnight. Now everything goes 100% ok and also much faster, problem solved :)
You need to use a 50 MHz crystal now (was 25 MHz), set bit 9 of the processors EMAC Command Register and change the hardware config slightly of the PHY.
Thanks to Ingmar Blonk and good luck!
Theo