Hi, I met a problem with my L137 EMAC local loopback code. Could anybody please give me any advice? Thank you!
The code is to loop back one 64-byte data packet inside EMAC. Somehow it can only work in promiscuous mode. This is why I say that: The data packet was able to be TX, but can only be received at RX Channel 0, and can only be received by Ch0 when 1) RXCAFEN bit (Receive copy all frames enable) was set, and 2) RX promiscuous channel selects Channel 0. Another observation is when the code was executed, both RXMCASTFRAMES (Multicast receive frames register) and TXMCASTFRAMES (Multicast transmit frames register) became 1 even RXMULTEN bit (RX multicast enable) was not set.
TI document says promiscuous mode happens when EMAC receives frames that do not match its address. I used the EMAC address labeled on EVM board. And below is how I used this addr in my code:
//MAC Addr
EMAC_MACINDEX = 0x00;
EMAC_MACADDRHI = 0x000e9902; // Needs to be written only the first time
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x01;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x02;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x03;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x04;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x05;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x06;
EMAC_MACADDRLO = 0xff57;
EMAC_MACINDEX = 0x07;
EMAC_MACADDRLO = 0xff57;
... ...
// MAC Source Addr
EMAC_MACSRCADDRHI = 0x000e9902; /* bytes 2-5 */
EMAC_MACSRCADDRLO = 0xff57; /* bytes 0,1 */