Ethernet Tx/Rx in iMXRt1060

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ethernet Tx/Rx in iMXRt1060

1,969 Views
EmbeddedTech
Contributor III

Hi @AbnerWang ,

I would like to use the Ethernet for simple Tx and Rx for sending commands from PC and reading the response from the device. I saw the enet_txrx_transfer demo project in the sdk. I am not sure how to use the MAC address and send commands from PC. Is there any example which I can refer for this requirement. It would be of great help if you could guide me on this.

Thanks.

Labels (1)
0 Kudos
Reply
10 Replies

1,956 Views
AbnerWang
NXP Employee
NXP Employee

Hi,

 

Do you mean you want to send layer2 MAC frame from PC to board?

Usually I use https://ostinato.org/. Or you can try Python Scapy, but I rarely use script to do this.

 

Best Regards.

Abner

Best Regards.
Abner
0 Kudos
Reply

1,943 Views
EmbeddedTech
Contributor III

Hi @AbnerWang,

I am new to Ethernet and if I want to use ethernet to send command from PC just like RS232 what changes should I do in the enet_txrx_transfer project? I see in the code that MAC address 

#define MAC_ADDRESS \
{ \
0x54, 0x27, 0x8d, 0x00, 0x00, 0x00 \
}

is assigned to the device. So if from my PC if I want to send command to this address and read back the response from the device, how do I implement it? Can I use Teraterm or other free utilities?

Your help on this is much appreciated.

Thanks.

0 Kudos
Reply

1,927 Views
AbnerWang
NXP Employee
NXP Employee

Hi,

I'm not sure whether the Teraterm support to send layer2 frame. It looks the command you want to send is TCP/IP packets. But SDK driver example only loopback MAC frames. If you want to get response, need to write extra code. Please refer the LwIP examples to find the example such as lwip_ipv4_ipv6_echo_freertos, then use your TCP/IP terminal to send packet to the board. You can get details in example readme.

Best Regards.

Ruijia

Best Regards.
Abner
0 Kudos
Reply

1,919 Views
EmbeddedTech
Contributor III

Hi @AbnerWang,

 

My requirement is to send a command to the meter to change a setting in the meter or read the settings from the meter using remote commands from PC. It is just like serial commands using RS232, no need of internet connectivity. I will try the lwip example which you have mentioned.

Just to understand more on the enet_txrx_transfer demo, so is it not possible to do a point to point communication using the MAC address?

Thanks.

0 Kudos
Reply

1,911 Views
AbnerWang
NXP Employee
NXP Employee

Of course you can use MAC address to do endpoint to endpoint transfer. But you need to code on both RT1060 and PC through a self-defined protocol.

Best Regards.

Best Regards.
Abner
0 Kudos
Reply

1,907 Views
EmbeddedTech
Contributor III

Hi @AbnerWang ,

Sorry for asking too many questions. Yes I can write a protocol on RT1060 side to process the received command and respond accordingly. Say if I send "LED 1" from PC then I can decode the command on RT1060 to turn on the LED on receiving this via Ethernet. But I am not sure how to send this command to RT1060 from PC via Ethernet. 

Thanks.

0 Kudos
Reply

1,899 Views
AbnerWang
NXP Employee
NXP Employee

Unfortunately I'm not expert on network development in PC environment. What I can tell is you need to find some middleware system interfaces. Whatever Linux or Window shall open some system interfaces to implement this. Or you can use other upper-layer soft module or library just like the Scapy.

Best Regards.

Best Regards.
Abner
0 Kudos
Reply

1,895 Views
EmbeddedTech
Contributor III

Hi @AbnerWang,

I will give this a try and get back to you.

Thanks for your help so far.

 

0 Kudos
Reply

1,826 Views
EmbeddedTech
Contributor III

Hi @AbnerWang,

I tried the Ethernet Tx and Rx using the UDP. I would like to know about the port number which we need to mention as 10001 while communicating with the board. Is this the registered port number by NXP to communicate with the boards? Also, using UDP is it possible for me to send messages from PC to multiple boards as the port number will be same?

Thanks.

0 Kudos
Reply

1,807 Views
AbnerWang
NXP Employee
NXP Employee

Hi,

1) What's the 'registered port' you mean? It should not be a vendor registered port, just our example use this port.

2) I don't own those net cases. But I think you may need to modify code, using multicast IP to communicate.

Best Regards.
Abner
0 Kudos
Reply