MACRAW for LLDP Packets?

I am using an Arduino Ethernet which uses the W5100 ethernet controller.

I want to send LLDP packets to do PoE+ power negotiation.

One issue is that when I send LLDP to the PoE Switch, it reports CRC error.

My question is whether or not the W5100 appends FCS to the MACRAW packets automatically, or do I have to add it to the payload myself?

Here is my Arduino code:

[code]#include <SPI.h> // needed for Ethernet library communication with the W5100 (Arduino ver>0018)
#include <Ethernet.h>
#include <utility/w5100.h>

SOCKET s; // our socket that will be opened in RAW mode
//LLDP packet
byte buf = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e, // lldp multicast mac address
0x90, 0xA2, 0xDA, 0x0F, 0x06, 0xD9, // arduino mac address
0x88, 0xCC, //ethertype
0x02, 0x07, //Chassis ID TLV (type 1, length 7)
0x04, // Chassis ID Subtype: Mac Address
0x90, 0xA2, 0xDA, 0x0F, 0x06, 0xD9, // arduino mac address
0x04, 0x04, // Port ID TLV (type 2, length 4)
0x05, // Interface Name
0x31, 0x2f, 0x37, // 1/7
0x06, 0x02, // Time to Live TLV (type 3, length 2)
0x00, 0x78, // 120 seconds

		 //4-wire Power-via-MDI
         0xfe, 0x05, // Optional TLV (type 127, length 5)
         0x00, 0x01, 0x42, //Cisco OUI Identifier
		 0x01, //Cisco Subtype
         B00000001,/*PSE/PD Capabilities
					Reserved Bits 7:4
					PSE Spare Pair Operational State: Bit3
						0=Disable
						1=Enable
					PD Spare Pais Desired State: Bit 2
						0=Disable
						1=Enable
					Spare Pair Detection/Classification required: Bit 1
						0=Disable
						1=Enable
					UPOE Supported: Bit 0
						0=Disable
						1=Enable */
						
		// DTE Power via MDI TLV
		0xfe, 0x0c, // Optional TLV (type 127, length 12)
		0x00, 0x12, 0x0f, // 802 OUI
		0x02, // 802.3 subtype
		B00000000, /* MDI Power Support
					Reserved: Bits 7:4 
					PSE Pair Control Ability Supported: Bit 3 
						0 = Not supported 
						1 = Supported 
					PSE MDI Power State Enabled: Bit 2 
						0 = Disabled 
						1 = Enabled 
					PSE MDI Power Support: Bit 1 
						0 = Not supported 
						1 = Supported 
					Port Class: Bit 0 
						0 = PD 
						1 = PSE   */
		0x01, // PSE Power Pair (pethPsePortPowerPairs IETF RFC 3621)
		0x05, // Power Class (pethPsePortPowerClassifications IETF RFC 3621)
		B01010011, /* Type/Source/Priority
					Power type: Bits 7:6 
						11 = Type 1 PD 
						10 = Type 1 PSE 
						01 = Type 2 PD 
						00 = Type 2 PSE 
					Power source: Bits 5:4 
						Where power type = PD 
							11 = PSE and local 
							10 = Local 
							01 = PSE 
							00 = Unknown 
						Where power type = PSE 
							11 = Reserved 
							10 = Backup source 
							01 = Primary power source 
							00 = Unknown 
					Reserved: Bits 3:2 
					Power Priority: Bits 1:0 
						11 = Low 
						10 = High 
						01 = Critical 
						00 = Unknown (default) */
		0x01, 0x90, // PD requested power value 1 to 510 decimal * 0.1 Watts (40W)
		0x00, 0x00, // PSE allocated power value 1 to 510 decimal * 0.1 Watts
		
         0x00, 0x00 // End of LLDP (type 0, length 0)

// ADD CRC HERE?
};
int buflen; // length of data to send

void setup() {

// initialize the w5100 chip and open a RAW socket
W5100.init();
W5100.writeSnMR(s, SnMR::MACRAW);
W5100.execCmdSn(s, Sock_OPEN);

}

void loop() {

buflen=sizeof(buf); // we will be sending ‘buflen’ bytes across the wire
// filling buffer with some data …

// sending buffer
W5100.send_data_processing(s, buf, buflen);
W5100.execCmdSn(s, Sock_SEND_MAC);

delay(5000);
}[/code]

Dear narcosis219,

W5100 appends FCS to the MACRAW packets automatically.
Thanks,

[quote=“suhwan”]Dear narcosis219,

W5100 appends FCS to the MACRAW packets automatically.
Thanks,[/quote]

Hi suhwan,

If the W5100 does append FCS automatically, then how do I fix my issue?

If I send this packet to the switch, it reports CRC error. If I try to view the packet in Wireshark, on 1 laptop I can see the packet successfully, but on 2 other laptops I don’t see the packet at all. It looks like the CRC is not checking out. Is there anything I can do to fix this?

Dear narcosis219,

Anyway, your system (included W5100) has the CRC Error.
If CRC of W5100 is uncorrect, you do not solve this problem.
However, we have not reported the CRC Error.

If the CRC of W5100 is correct, CRC error could be caused by hardware.
Would you explain your hardware(schemetic) and network in more detail?

Thanks,

Hi suhwan,

I am using the Arduino Ethernet board:

arduino.cc/en/Main/ArduinoBoardEthernet

Schematic and data can be found on there.

The code I am using is in my first message.

I am connecting the board directly into this switch: cisco.com/c/en/us/products/c … 09864.html It reports CRC errors.

I am also connecting the board directly into the Ethernet port of Laptops. The Laptops are running Wireshark, but only 1 laptop can successfully receive the LLDP packets. The others do not see the packet.

When I use UDP communication, there is no issue, but when I try to do LLDP with MACRAW, there are CRC errors.

Hi narcosis219,

Thank you for your explanation.

It is used same algorithm for Ethernet CRC32 in UDP and MACRAW mode.
If CRC algorithm in W5100 was uncorrect, it is happened same CRC errors in UDP mode.
We don’t know whether or not the CRC32 is not support in LLDP.

Your code is verified.

Please, check the setting of peer(switch or others laptop).
ex.) When Laptop is connected PoE swtich, send LLDP packets by using LLDP packet generator.

Thanks,

[quote=“suhwan”]Hi narcosis219,
Please, check the setting of peer(switch or others laptop).
ex.) When Laptop is connected PoE swtich, send LLDP packets by using LLDP packet generator.
[/quote]

Hi suhwan,

I have connected other computers and devices (Cisco IP Phone cisco.com/c/en/us/products/c … index.html) to the PoE Switch. All of them successfully communicate with LLDP.

I have used LLDP packet generators and can successfully talk to the PoE Switch. Only the Arduino reports CRC errors.

Hi suhwan,

I noticed that on the Switch I forced 10BASE-T, then I no longer get CRC errors. Does this make sense?

Hi narcosis219,

The algorithm of Ethernet CRC32 is same in 10BASE-T and 100BASE-T.
We think that it is easy to effect noise in hardware when frequency is high (100BASE-T).

  1. Would you check whether or not CRC errors are happened when board (w/ PoE) is connected normal switch (not PoE switch)?

  2. Would you check whether or not CRC errors are happened when board (w/o PoE) is connected normal switch (not PoE switch)?

Thanks,