MAC layer doesn't seem to be adding SRC and DEST MAC addresses to payload in MACRAW mode

Hello, I am using W6100 in MACRAW mode with LWIP stack (on my host controller).

When I send a packet over SOCKET0, it seems like w6100 is sending it out without adding source and destination MAC addresses.

My test setup:

  1. Host controller operates w6100 over SPI in MACRAW mode
  2. W6100 is connected to my PC over Ethernet cable
  3. I am using Wireshark to monitor traffic over Ethernet interface


   ctlwizchip(CW_SYS_UNLOCK, &syslock);
   setSn_DHAR(0, DHAR);
   setSn_MR(0, 7);

ret = socket(0, Sn_MR_MACRAW, 0, SF_ETHER_OWN);

uint8_t pbuf[SL_ETH_PKT_LEN] = {0};
int i = 0;
for (i = 0; i < SL_ETH_PKT_LEN; i++)
    pbuf[i] = i;

while (1)
    send(0, pbuf, 64);

I understand that send/recv APIs are only for TCP, IPv4/6 modes. So, I have by-passed
if ((tmp != SOCK_ESTABLISHED) && (tmp != SOCK_CLOSE_WAIT)) check in the API so that I am able to write on SOCKET0 buffer.

So, my payload is: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f . . . 40

However, at my PCs end Wireshark is showing SRC address as 06 07 08 09 0a 0b. So, it seems like MAC of W6100 did not append Ethernet MAC headers to my payload.

Am I supposed to add MAC headers in my application? Or am I doing something wrong?
Also, are there any sample codes/resources available for MACRAW mode?



Macraw mode does not create ethernet headers. Therefore, it is recommended to use IPraw mode or create an Ethernet Header yourself. In case of Ethernet Header, it consists of Destination Mac Address(6byte) + Source Mac Address(6byte) + type (4byte ex IPv4: 0x0800).