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

Thread: HELP!!! Teensy & Arduino Conflict on a Mac

  1. #1

    HELP!!! Teensy & Arduino Conflict on a Mac

    Hi everyone,
    I am totally new to the teensy. I just bought one and couldn't make it read the Arduino code.
    I just called technical support and they suggested I present my problem here, to people with Macintosh experience.
    They are the ones who said the problem seems to be in the communication between Arduino and the Teensy Loader.

    My operating system is High Sierra 10.13.4

    So, the teensy board works. Arduino works, but when I try to verify the code in Arduino, it doesn't do it.
    I am attaching here the screenshot of the error it gives me.
    I am also attaching the "verbose log" that I get.

    PLEASE HELP!!! I'd really appreciate it.
    Thank you very much!!!

    Andrea
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screen Shot 2019-11-06 at 4.22.16 PM.jpg 
Views:	10 
Size:	115.9 KB 
ID:	18134  
    Attached Files Attached Files

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,828
    We talked on the phone.

    I can see the problem in the verbose info log. It's this line:

    Code:
    16:19:09.744 (loader): Unable to listen for remote control
    But why Teensy Loader can't listen for Arduino to send it commands it quite a mystery.

    Could you try opening Applications > Utilities > Terminal, and then in the terminal type "ifconfig lo0". This will print info about the localhost networking configuration on your Mac.

    When I try it here, I get this:

    Code:
    MacBook-Air:~ paul$ ifconfig lo0
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
            options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
            inet 127.0.0.1 netmask 0xff000000
            inet6 ::1 prefixlen 128
            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
            nd6 options=201<PERFORMNUD,DAD>
    I must confess, I'm not a Mac expert. But I would really like to understand why Teensy Loader isn't able to listen for Arduino to control it. If we could get a real understanding, maybe in future versions that rather unhelpful error message could be improved to give useful advice?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,828
    FWIW, that line in the verbose info log is supposed to look like this:

    Code:
    07:17:50.226 (loader): Listening for remote control on port 3149
    If the "ifconfig lo0" results don't show anything useful, maybe someone more familiar with MacOS or BSD Unix will know a way to use commands like "netstat" to dig further?

  4. #4
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    197
    I can try to reproduce this here, but first I assume you checked to see that this isn't an issue with the firewall configuration?

  5. #5
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    197
    Can't reproduce here with Teensy loader 1.47 on High Sierra 10.13.6 with firewall on or off.

    Paul: is there any way to get the error result that prints that message?

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,828
    Quote Originally Posted by blackketter View Post
    Paul: is there any way to get the error result that prints that message?
    Teensy Loader is (mostly) built on top of the wxWidgets GUI library. This error ultimately comes from wxSocketServer. Here's the source code. Hopefully nothing too surprising.

    Code:
    void MyFrame::start_ipc_server(void)
    {
            unsigned short port[3]={3149,25981,6837 /*,4782,5293,13752*/};
            wxIPV4address addr;
            int i;
    
            for (i=0; i<3; i++) {
                    addr.LocalHost();
                    addr.Service(port[i]);
                    ipc_server = new wxSocketServer(addr, wxSOCKET_WAITALL | wxSOCKET_REUSEADDR);
                    if (ipc_server->IsOk()) {
                            printf("Listening for remote control on port %d", port[i]);
                            ipc_server->SetEventHandler(*this, ID_SERVER);
                            ipc_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
                            ipc_server->Notify(true);
                            return;
                    }
            }
            printf("Unable to listen for remote control");
    }
    Internally, I believe wxSocketServer is a pretty thin abstraction around the usual BSD socket functions. So it's (probably) just creating a socket file descriptor and calling bind() and listen(). But we don't get a pass/fail from the IsOK() function.

    This problem is so rare that pretty much no work has been done to get better info when IsOK() returns false for all 3 port numbers. Long ago, we used to get occasional reports from Windows users with the Zone Alarm firewall software. But eventually Zone Alarm fixed their software so it didn't interfere with localhost communication. The only other case I can recall was a Linux user who had messed up his localhost settings (using something other than 127.0.0.1) by aggressively editing too much stuff.

    Without more info from @AndreaCarmen, like the output from "ifconfig lo0", I just don't see any way to figure out what went wrong.

  7. #7

    it worked!!

    Good morning!
    Sorry it took so long to finally try it.
    I did it yesterday and it worked immediately! :-)
    Thanks so much for the help!
    Best,

    Andrea





    Quote Originally Posted by PaulStoffregen View Post
    We talked on the phone.

    I can see the problem in the verbose info log. It's this line:

    Code:
    16:19:09.744 (loader): Unable to listen for remote control
    But why Teensy Loader can't listen for Arduino to send it commands it quite a mystery.

    Could you try opening Applications > Utilities > Terminal, and then in the terminal type "ifconfig lo0". This will print info about the localhost networking configuration on your Mac.

    When I try it here, I get this:

    Code:
    MacBook-Air:~ paul$ ifconfig lo0
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
            options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
            inet 127.0.0.1 netmask 0xff000000
            inet6 ::1 prefixlen 128
            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
            nd6 options=201<PERFORMNUD,DAD>
    I must confess, I'm not a Mac expert. But I would really like to understand why Teensy Loader isn't able to listen for Arduino to control it. If we could get a real understanding, maybe in future versions that rather unhelpful error message could be improved to give useful advice?

  8. #8

    it doesn't work again...

    Sorry for the confusing posts and the delay in addressing this.

    So, just yesterday I had time to look into this again.
    To make sure I was doing things right, I uploaded everything in my old laptop and everything worked well.
    So, then I tried it in the new one (macOS 10.13.4) and it worked perfectly.
    However this morning I am finding again the same problem...

    This is what I get in "Terminal"

    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    nd6 options=201<PERFORMNUD,DAD>


    I reiterate that I am not familiar at all with all this.
    My firewall is off.
    Thanks for the help!!
    Andrea

  9. #9
    Senior Member
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    197
    Do you have any third-party virus, networking or firewall software installed on your computer?
    Last edited by blackketter; 11-13-2019 at 06:47 PM.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,828
    The command in the Terminal only prints info. It doesn't (or certainly should not) change or affect anything.

    Since the problem is happening sometimes but not others, there's a good chance it's being caused by some other software you have running. But what, I have no idea. I would really like to know, so please if you do figure it out or gain any useful info, please remember to post a followup message here. Maybe when this is finally resolved we can learn what really happened and prevent it in the future, or at least improve the error message with helpful info?

    I reiterate that I am not familiar at all with all this.
    Macintosh and BSD Unix (the underpinning of MacOS) aren't exactly my specialty.

    I believe there's a "netstat" command you can run in Terminal that prints a *lot* of info about the networking setup on your computer. Maybe try that and copy the results to a message here? Or maybe try "netstat -i lo0", which should cause it to only print info about the localhost networking between programming running on your Mac, if the normal "netstat" prints far too much info.

    Again, running "netstat" isn't supposed to fix or change anything. It simple prints info. Maybe something in that info will stand out as the cause or at least some more clues about the problem?

  11. #11
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,240
    it's possible that lsof -i might provide clues or dtruss (like linux strace)

    as others noted, it sounds like some sort of firewall is preventing "local" TCP connections

  12. #12

    it works again...

    Sorry again for the delay. I just didn't have the time to sit down.
    Anyway, I finally tried again today and it works!
    The only thing that I had opened before was Chrome.
    I tried it today with and without Chrome running and it works both ways. I can't reproduce the problem anymore.
    So, all is good for now....
    Hopefully, it will continue.
    Thank you very much for your response & my apologies again because it took me so long to look into it.
    Best!
    A.




    Quote Originally Posted by PaulStoffregen View Post
    The command in the Terminal only prints info. It doesn't (or certainly should not) change or affect anything.

    Since the problem is happening sometimes but not others, there's a good chance it's being caused by some other software you have running. But what, I have no idea. I would really like to know, so please if you do figure it out or gain any useful info, please remember to post a followup message here. Maybe when this is finally resolved we can learn what really happened and prevent it in the future, or at least improve the error message with helpful info?



    Macintosh and BSD Unix (the underpinning of MacOS) aren't exactly my specialty.

    I believe there's a "netstat" command you can run in Terminal that prints a *lot* of info about the networking setup on your computer. Maybe try that and copy the results to a message here? Or maybe try "netstat -i lo0", which should cause it to only print info about the localhost networking between programming running on your Mac, if the normal "netstat" prints far too much info.

    Again, running "netstat" isn't supposed to fix or change anything. It simple prints info. Maybe something in that info will stand out as the cause or at least some more clues about the problem?

Posting Permissions

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