Is it possible to send TCP via MACRAW socket?
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
- Replies
- 6
- Views
- 2,501
- Likes
- 0
Participants
In this topic
Similar topics
- It is possible to send a UDP bigger than 1472 Bytes?
- Is it possible to send Multicast UDP without Joining a group?
- W5500 MACRAW mode send delay
- TCP connection only possible with a 2-4 sec delay between init and socket programming
- Is it possible to get the INTn pin to go low when a specific UDP socket receives data?
RE: Is it possible to send TCP via MACRAW socket?
by suhwan ·
Hi,
As you know, MACRAW can handle the Ethernet frame.
Hence, you can send any Ethernet packet in MACRAW mode.
Please, check your codes and refer to below pseudo code.
| Ethernet header | IP header | TCP (or UDP) header | payload |
Thanks,
RE: Is it possible to send TCP via MACRAW socket?
by mattsmith ·
Hi Suhwan,
Thank you for the reply. In looking at your source code I am not checking the command register or interrupt register after the send and not clearing the send ok bit, so I will try that.
When I send a MACRAW packet, if it is an IP packet (ether type 0x0800) do I need to have the checksums correct for it to be sent out? Does it do any checking on the accuracy of the packet I send or does it allow me to just send any stream of bytes even if it is an incorrectly formatted packet? Do I need to at least a correct ethernet header?
Thanks,
-Matt
RE: Is it possible to send TCP via MACRAW socket?
by suhwan ·
Hi Matt,
We recommend the clear checking of the command register and ‘send ok’ bit.
2.
Yes. In MACRAW mode, you should be calculate the checksum of IP header and TCP (or UDP) header.
3.
The incorrectly formatted packet is send out.
I’m not sure but Packet capture program, as like WireShark, does not display/capture the incorrectly formatted packet.
4.
Yes. W5500 generates preamble and FCS. Therefore, you make Ethernet Frame expect FCS and preamble.
– Ethernet Frame Types –
| preamble | Destination MAC address | Source MAC Address | Lengh/Etheret type | …DATA… | FCS |
5.
[quote]// ****************************************************************************
// send a message using MACRAW socket
// ****************************************************************************
int8s wiznetTxRaw(int8u* ipAddr, int16u dataLen, int8u* data)
{
…
// Socket 0 command register = SEND = 0x20
sc1SpiReadOrWrite6BytesOrLess(SPI_WRITE, BLOCK_SOCKET0_REGISTER, 0x0001, 1, 0x20, 0,0,0,0,0);
[color=#BF0040]/bug: the Sn_TX_WR should be incremented before Send Command/
// increment Sn_TX_WR
currentPosition = currentPosition + dataLen;
emberSerialPrintf(gAppSerial, “Write Sn_TXWR = %d\r\n”, currentPosition);
sc1SpiReadOrWrite6BytesOrLess(SPI_WRITE, BLOCK_SOCKET0_REGISTER, 0x0024, 2, HIGH_BYTE(currentPosition), LOW_BYTE(currentPosition), 0,0,0,0);
/bug: the Sn_TX_WR should be incremented before Send Command/[/color]
…
return 0;
}[/quote]
We get a bug on your codes.
In your code, the Sn_TX_WR is incremented after Send command in wiznetTxRaw().
But, the Sn_TX_WR should be incremented before Send Command.
Thanks,
RE: Is it possible to send TCP via MACRAW socket?
by Zick ·
[quote=“suhwan”]Hi Matt,
We recommend the clear checking of the command register and ‘send ok’ bit.
[/quote]
Checking Sn_IR I always get 0x20 instead of 0x10.
According to DS this is a reserved bit. So I (and probably other MACRAW-users) still don’t know whether the frame was transmitted on wire or not.
At least my W5500 chip transmitted frames even if the header was wrong. E.g. I sent a frame with type=0 and length=0 and it arrived at the other side (using a direct connection, no switch in between)
RE: Is it possible to send TCP via MACRAW socket?
by hjjeon0608 ·
Hi, Matt
You can see the packet with wireshark although the packet is wrong format, I know.
So if you can’t see packet is sent in Wireshark, check preamble header.
As I know, preamble must be correct.
Thanks.
RE: Is it possible to send TCP via MACRAW socket?
by seindich ·
I have recently succeeded in sending/receiving raw frames, but still wonder if the chip (w5500) has undocumented ability to forge FCS field (also the way to receive packets with non-standard FCS regarded). Is there any chance?
I’m asking because read in datasheet for older chip that it is possible to at least receive CRC value.
regards