This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EMAC transmition problems

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!

0