Hi all,
[What I really want is to open a discussion on the virtual_nic Freescale example to understand it better. But in other forums I find it more effective to ask one specific per thread. Please let me know if that is not the culture here.]
I have compiled and uploaded the Freescale 4.1.1 virtual_nic example to a Tower w/a K70. I am working with IAR Workbench. How do I verify it is working?
I have read somewhere that this example only implements one direction of the Ethernet-over-USB to Ethernet connection. If so, I am at a loss to think of a good test for this example. Further, inspecting the code, it looks symmetrical. That is, I believe I see code for transmitting in both directions (USB port and RJ45 port).
In another post/thread, a Freescale employee said I should be able to PING the connection. I tried this but apparently it did not work.
-thank you
Success, I have been able to ping this example. But only after I change the IP address found in virtual_nic_enet.h. If I don't change it to match the subnet of the network I plug the RS45 into, the ping does not work. Further, when I am using the default IP address and I look at the output of "route print", I see values that come close but DO NOT MATCH the default IP address found in virtual_nic_enet.h.
Maybe to some this is just plain Windows-networking-101. But to me it is darn confusing - and I would really appreciate it if someone could set me straight.
For instance, if this example is truly only a Ethernet gate way between the USB world and the RJ45 world - then why is there even the need for an IP address?
-thanks
I take that back. No success here. I am trying to duplicate Freescale employee's Martin comment that he plugged a router into the TWR-SER RJ45. But that does not create the expected network (It does create a new network but the expected routing is missing). As a GOLD test I used a off-the-shelf TRENDNET Ethernet over USB to Ethernet 10/100BaseT converter dongle in place of the Freescale TWR running the Freescale CDC Ethernet over USB example. That worked with the router. It created a network and the Win7 box connected through the router's WIFI to the local network. I repeated this GOLD test successfully using Ubuntu and all the same hardware (same Win7 box, TRENDNET & ASUS router).
Any pointers getting this Freescale running like the TRENDNET dongle would be appreciated.
-thanks
Tidying up this thread...
I think the Freescale virtual_nic CDC Example has a problem in the USB to Ethenet direction. I explain what I did here in this thread:
I'm not sure my solution is a good one. But I can ARP and Ping now using my modified virtual_nic code.
Thank you for your bug report.
It was reported to our internal bug database and it will be fixed in one of next MQX releases.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I think I found the problem. In file "virtual_nic_enet.c" in "fuction VNIC_FEC_Send()" if you change this code:
USB_mem_copy(ethernet_frame_ptr + 2 * MAC_ADDR_SIZE, | |
g_enet_hdr.TYPE, 2); |
protocol = *((uint16_t *)(((ENET_HEADER_PTR)ethernet_frame_ptr)->TYPE)); |
nic_pcb = _mem_alloc_system_zero(sizeof(PCB) + sizeof(PCB_FRAGMENT)); | |
if(nic_pcb == NULL) |
...to this...
USB_mem_copy(ethernet_frame_ptr + 2 * MAC_ADDR_SIZE, | |
g_enet_hdr.TYPE, 2); |
protocol = *((uint16_t *)(((ENET_HEADER_PTR)ethernet_frame_ptr)->TYPE)); |
protocol = htons(protocol); |
nic_pcb = _mem_alloc_system_zero(sizeof(PCB) + sizeof(PCB_FRAGMENT)); | |
if(nic_pcb == NULL) |
The Type field sent out the RJ45 side will work for ARP & Ping. It appears to work for other message but I wasn't testing for them specifically.
-thanks