Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 12 1 2 3 11 ... LastLast
Results 1 to 25 of 291

Thread: USB Host Ethernet Driver

  1. #1
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402

    USB Host Ethernet Driver

    USB Host Ethernet Driver
    Based on the suggestion by Defragster, here's a new thread for the efforts going towards getting a driver going for USB to Ethernet adapters.
    My own example can be found here: TeensyASIXEthernet
    It's based on the ASIX AX88772B chipset although it may work for other ASIX chipsets.
    Any help that can be offered would be greatly appreciated because I know this can turn into something that could be pretty useful.

    Basic testing shows this is receiving messages and can also transmit messages so it's at least a start.
    Click image for larger version. 

Name:	Screen Shot 2019-09-20 at 5.28.13 PM.jpg 
Views:	36 
Size:	173.7 KB 
ID:	17679

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,221
    Was just browsing the other thread and peaked my interest. Just ordered a USB2LAN adapter (usb2.0 amazon basic). Already have a usb 2 wireless adapter so that will get interesting. Think it will really get fun when the usb 2 wireless is working.

  3. #3
    Senior Member
    Join Date
    Aug 2017
    Posts
    139
    Quote Originally Posted by vjmuzik View Post
    USB Host Ethernet Driver
    Based on the suggestion by Defragster, here's a new thread for the efforts going towards getting a driver going for USB to Ethernet adapters.
    My own example can be found here: TeensyASIXEthernet
    It's based on the ASIX AX88772B chipset although it may work for other ASIX chipsets.
    Any help that can be offered would be greatly appreciated because I know this can turn into something that could be pretty useful.

    Basic testing shows this is receiving messages and can also transmit messages so it's at least a start.
    Click image for larger version. 

Name:	Screen Shot 2019-09-20 at 5.28.13 PM.jpg 
Views:	36 
Size:	173.7 KB 
ID:	17679
    @vjmuzik - Just ordered the adapter from Amazon. Will be here this next Tuesday. Thanks for the link to GitHub. Once this layer is working, Maybe wireless
    Did you get your reference manual from the ASIX website?

  4. #4
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    I was going to get it from their site, but you need to be registered so I just googled searched for it and found it.
    Here's a link to the one I'm using.

  5. #5
    Senior Member
    Join Date
    Aug 2017
    Posts
    139
    Quote Originally Posted by vjmuzik View Post
    I was going to get it from their site, but you need to be registered so I just googled searched for it and found it.
    Here's a link to the one I'm using.
    Yeah, I ran into that as well. I don't own a business but work for one.
    Thanks for the link.

  6. #6
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    So more progress has been made, I've been working on porting the fNET TCP/IP Stack and I believe I've got the whole thing working, but the most I've tested is making sure DHCP works and the stack seems to be responding to everything pretty well.

    As you can see here between the Serial monitor and Wireshark the DHCP is responding and the Teensy has an IP Address.
    Click image for larger version. 

Name:	Screen Shot 2019-09-25 at 1.39.17 PM.jpg 
Views:	22 
Size:	244.8 KB 
ID:	17714

  7. #7
    Senior Member
    Join Date
    Aug 2017
    Posts
    139
    Quote Originally Posted by vjmuzik View Post
    So more progress has been made, I've been working on porting the fNET TCP/IP Stack and I believe I've got the whole thing working, but the most I've tested is making sure DHCP works and the stack seems to be responding to everything pretty well.

    As you can see here between the Serial monitor and Wireshark the DHCP is responding and the Teensy has an IP Address.
    Click image for larger version. 

Name:	Screen Shot 2019-09-25 at 1.39.17 PM.jpg 
Views:	22 
Size:	244.8 KB 
ID:	17714
    @vjmuzik - Again, this is great Looks like the Teensy is walking away from SPI Ethernet and going to faster transfer speeds. Are you using this for MIDI applications? I got my Amazon Basic USB 2.0 yesterday. Cloned your code. In ASIXEternet_test.ino I had to comment out the code with 'hostAddress' out to get it to compile but after that it was working. It looks like you are using this for MIDI applications. In any case this will move us closer to WIFI.

  8. #8
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Not specifically MIDI, but it may as well be. The Ethernet should work in the general sense for just about anything, this TCP/ IP stack seems to be pretty powerful at least more so than the standard Ethernet library we already use. Good thing is that the way I’ve ported the library it has nothing to do with USB itself and can be used with pretty much any interface. It basically works by presenting the Arduino sketch with a bunch of callbacks that need assigned for various things, but at the most basic point two callbacks are used for input and output from the stack. So it can more or less be used with any mode of transport so what I write in my callback functions calls to the usb driver, but they aren’t codependent on each other.

    That being said, I still need to clean up some of the code from my porting and then that will be published as it’s own library that can be used to go along with the USB driver.

  9. #9
    Senior Member
    Join Date
    Aug 2017
    Posts
    139
    Quote Originally Posted by vjmuzik View Post
    Not specifically MIDI, but it may as well be. The Ethernet should work in the general sense for just about anything, this TCP/ IP stack seems to be pretty powerful at least more so than the standard Ethernet library we already use. Good thing is that the way I’ve ported the library it has nothing to do with USB itself and can be used with pretty much any interface. It basically works by presenting the Arduino sketch with a bunch of callbacks that need assigned for various things, but at the most basic point two callbacks are used for input and output from the stack. So it can more or less be used with any mode of transport so what I write in my callback functions calls to the usb driver, but they aren’t codependent on each other.

    That being said, I still need to clean up some of the code from my porting and then that will be published as it’s own library that can be used to go along with the USB driver.
    @vjmuzik - Understood. I think a lot of people are watching this. Watching and learning. Good stuff

  10. #10
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Also coincidentally fNET already has native ports for the native Ethernet for the chips used in the Teensy 3.6/4.0 so once we have a bigger version of the 4.0 we should have native Ethernet pretty easily. Probably a little bit of tweaking to get it working with TEENSYDUINO, but at least most of the code will already be done as far as configuring the Ethernet and setting up the buffers. As far as the Teensy 3.6 if anyone has one of the shields that Paul designed for it I’m sure this would be a great way to test the native ethernet besides the ones already done with lwip.

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    My amazon cart - with the wired Basic Lan to USB unit - got sent with last order - will be here 9/26. @mjs513 probably already unpacked his?

    Don't expect to help much except some test runs.

  12. #12
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Went to github.com/vjmuzik/TeensyASIXEthernet
    Moved ino into folder named for it.
    Getting the error: ASIXEthernet_Test:101: error: 'hostAddress' was not declared in this scope

    Removed 'hostAddress' refs as noted above and suppose it is working …

    Also noticed it is okay to unplug/replug LAN cable and it recovers/continues. Same pulling the USB cable too!

    Tested first on the @loglaw T4 beta breakout

  13. #13
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Alright I believe this is ready for more testing to be done, I've pushed commits to GitHub and forked the FNET library into an Arduino library.
    TeensyASIXEthernet Driver
    FNET Arduino Library
    Included with the FNET library is a simple DHCP example that uses TeensyThreads to run the USB and TCP/IP stack in its own thread.
    This example doesn't technically support hot plugging completely right now, the usb and the ethernet cable have to be plugged in when it's first powered on, but after that it can be hot plugged. I'm pretty sure this is an easy fix though since the only thing stopping it is how I have DHCP setup, but for now all cables do have to be plugged in when you first power it on.
    The USB driver still needs work to transfer big packets of data as you can only ping up to 464 bytes right now, but it works up to that from my testing.
    Click image for larger version. 

Name:	Screen Shot 2019-09-27 at 11.43.05 AM.png 
Views:	5 
Size:	35.0 KB 
ID:	17732
    This ping test is going over WiFi to my laptop so don't be too discouraged by the numbers.

  14. #14
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,221
    @vjmuzik

    Just downloaded both libraries that you linked in post #13 but didn't see any example sketches in the FNET or ASIX libraries

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Very cool sounding update and progress!

    Quote Originally Posted by mjs513 View Post
    @vjmuzik

    Just downloaded both libraries that you linked in post #13 but didn't see any example sketches in the FNET or ASIX libraries
    Indeed - same - not seeing sketch in 'examples' or other folder. Can't test ping

  16. #16
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Yeah, I found the examples folder, I didn't copy it to the right place, now it's on there.

  17. #17

  18. #18
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Running the sample I get this … not sure what to do with it? IPAddress: 1700A8C0 ???
    Code:
    USB Host InputFunctions example
    USB Ready
    TCP/IP stack initialization is done.
    
    SetMACAddress: 0050B6BE8BB4
    MulticastJoin: 333300000001
    MulticastJoin: 3333FFE225AB
    netif Initialized
    DHCP initialization done!
    Looped: 1
    LoopedUSB: 1993441
    Looped: 1
    LoopedUSB: 0
    Looped: 1
    LoopedUSB: 0
    IPAddress: 0
    SubnetMask: 0
    Gateway: 0
    DHCPServer: 0
    State: 2
    
    
    IPAddress: 1700A8C0
    SubnetMask: FFFFFF
    Gateway: 100A8C0
    DHCPServer: 100A8C0
    State: 5

  19. #19
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Those are in Network Byte order so your IP address is C0,A8,00,17 or 192.168.0.23, I need to make that readable in the Serial Monitor, but network byte order is what the TCP/IP stack gives me.

  20. #20
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Thanks - I knew it wasn't right forward - hadn't gotten as far as reversing bytes. Initial Fail then better on wired PC to wired T4::
    Code:
    Pinging 192.168.0.23 with 32 bytes of data:
    Request timed out.
    Reply from 192.168.0.23: bytes=32 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=32 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=32 time=1ms TTL=64
    
    Ping statistics for 192.168.0.23:
        Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 1ms, Average = 0ms
    
    C:\>ping 192.168.0.23
    
    Pinging 192.168.0.23 with 32 bytes of data:
    Reply from 192.168.0.23: bytes=32 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=32 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=32 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=32 time=1ms TTL=64
    
    Ping statistics for 192.168.0.23:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 1ms, Average = 0ms

  21. #21
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Yeah I noticed sometimes the first byte of a ping message is lost because your computer will ask your modem who's at the IP address and it would send the ping before knowing who to send it to resulting in a request timed out.

  22. #22
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Cool after that initial (on a restart) it works well - occasional 3 or more ms on one ping in a group ping but this group of 10 - size 400 bytes - all fast:
    Code:
    C:>ping -l 400 -n 10  192.168.0.23
    
    Pinging 192.168.0.23 with 400 bytes of data:
    Reply from 192.168.0.23: bytes=400 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time=2ms TTL=64
    Reply from 192.168.0.23: bytes=400 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time=1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time<1ms TTL=64
    Reply from 192.168.0.23: bytes=400 time<1ms TTL=64
    
    Ping statistics for 192.168.0.23:
        Packets: Sent = 10, Received = 10, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 2ms, Average = 0ms

  23. #23
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Seems good, now I just need to work out large messages.

  24. #24
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    402
    Alright I've fixed the DHCP print information so now it's readable.

  25. #25
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,968
    Yes, yes you did - good work:
    Code:
    IPAddress: 192.168.0.23
    SubnetMask: 255.255.255.0
    Gateway: 192.168.0.1
    DHCPServer: 192.168.0.1
    State: 5
    ALSO noteworthy and commendable - has USB Hub support!::

    While running I pulled the USB LAN adapter from T4 Host plug - put it onto a powered HUB - plugged Hub into @loglow T4 USB breakout board - and PING worked without restart!

    So now running with USB LAN adapter on powered HUB the "USB Host InputFunctions example" … ASIXEthernet_Test.ino

    Cool that it is working with TeensyThreads! Was that out of necessity to make sure it ran or just because it seemed a cleaner way to start?

    ONE BUILD NOTE from console::
    >> Error while detecting libraries included by T:\tCode\libraries\FNET\src\service\serial\fnet_se rial.c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •