Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: 4.1 - NativeEthernet - Ethernet.begin hangs program

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2021
    Posts
    6

    4.1 - NativeEthernet - Ethernet.begin hangs program

    I am wondering whether anyone can help please. Using NativeEthernet on a 4.1 results in 'Ethernet.begin()' hanging the program. Using Ethernet.Begin in DHCP or full IP mode makes no difference. I haven't got a 'shield' or live socket attached, it's just the Teensy on its own. I am also using an SD card but whether present or not has no effect.

    Code:
    Ethernet.begin(m_serverMacc, m_serverip, m_dnsserver, m_gateway, m_subnet);
    I am getting the MAC from the Teensy using https://forum.pjrc.com/threads/57595...ess-Teensy-4-0 and that seems to be functioning fine. Can anyone suggest things I need to research, or indeed, has anyone else had this problem?

    It only happens when using the NativeEthernet library, not the standard Ethernet one.

    Thanks.
    Last edited by MartinJR; 05-11-2021 at 06:10 PM. Reason: Forgot to mention library

  2. #2
    It's normal. If you do not have a cable connected it will hang forever.

    You can see it on line 293. I believe it was left that way to be consistent with the original Ethernet library but you can comment it out which is the solution I used in my project.
    https://github.com/vjmuzik/NativeEth...ernet.cpp#L293

    Here is vjmuzik's explanation. I do wish there was a better solution as I do not like modifying libraries and having to worry about updates.
    https://forum.pjrc.com/threads/65653...l=1#post265000
    Last edited by Spencez; 05-12-2021 at 12:13 AM.

  3. #3
    Junior Member
    Join Date
    May 2021
    Posts
    6
    Thanks for that. What a gotcha!

    Yeah, editing libraries is never a good idea but I have a similar issue to K7MDL - the application needs to keep running regardless of a connection. Interestingly, the oridinary ethernet library doesn't have this problem, although maybe something else is happening instead!

Posting Permissions

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