Shop OBEX P1 Docs P2 Docs Learn Events
Programatically identifying Propellers — Parallax Forums

Programatically identifying Propellers

Is there a way to identify Props the same way that e.g. the Propeller IDE does via "Identify Hardware", where it scans the COM ports and identifies which one a prop is plugged into?

I want to extend it in my application to detect multiple props.

Thanks!

Comments

  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2020-06-10 17:31
    Do you want to detect a prop from the computer's USB/Serial ports or do you want to detect a prop from another prop?
  • Do you want to detect a prop from the computer's USB/Serial ports or do you want to detect a prop from another prop?

    Via USB port. It's been almost a comedy all the ways I've tried to figure this out myself:

    Looking at the open source Propeller IDE code, and going down the rabbit hole of C++ calls leading to some esoteric dead ends.
    Looking at the open source Propellant code, which also dead ends.
    Looking at the open source P1 bootloader, which gives me an idea of what's going on with the "Identify Hardware" response but isn't opaque.
    Sniffing the TX/RX lines w/ my digital logic analyzer, but getting garbage regardless of the baud.

    At this point I just want to know what serial packets I need to send to a given COM port to trigger a P1 on that port to respond with an identifying response, and what that respose should look like.

    My use case is that I have a system of P1s, and there may be dozens of COM ports in use on the computer. I want to scan over the ports, identify which ones are hosting P1s, and then I can move on to working with only those ports.

    Thanks!
  • Why not just have your program start a process that executes Propellent with the proper arguments, then reads its output? That's the way I've always handled the situation in my Perl code.

    -Phil
  • I think the problem you are describing is actually Windows' fault in the way it assigns com ports in ever increasing number. I know older versions of WIndows did this. Which version are you using?

    On Linux by way of comparison, the first serial USB that is plugged in becomes ttyUSB0 etc. No guessing which port it is connected to if it's the only one plugged in.
  • Peter,

    Is it Windows, or is it the FTDI driver? I suspect the latter.

    -Phil
  • AribaAriba Posts: 2,690
    escher wrote: »
    ...
    At this point I just want to know what serial packets I need to send to a given COM port to trigger a P1 on that port to respond with an identifying response, and what that respose should look like.

    My use case is that I have a system of P1s, and there may be dozens of COM ports in use on the computer. I want to scan over the ports, identify which ones are hosting P1s, and then I can move on to working with only those ports.

    Thanks!

    Here is a description of the serial boot sequence: https://forums.parallax.com/discussion/comment/1209149/#Comment_1209149

    The whole thread is about Serial Loaders, an there are maybe ten others. There is also a Spin code in the library that shows how to detect a propeller an load it (PropellerLoader.spin).

    Andy

  • escherescher Posts: 138
    edited 2020-06-11 02:33
    Why not just have your program start a process that executes Propellent with the proper arguments, then reads its output? That's the way I've always handled the situation in my Perl code.

    -Phil

    As far as I can tell, the only way to do that programatically is to disable its gui, redirect its output to a file, open that file, parse that file, and determine from that if a given port has a P1 on it - because for some reason /id doesn't print anything to stdout and explicit redirection doesn't work. THEN you have to repeat that process for every single port. On top of that, it's not cross-platform compatible. I appreciate the suggestion though, I definitely tried to squeeze a solution out of it.
    Ariba wrote: »
    escher wrote: »
    ...
    At this point I just want to know what serial packets I need to send to a given COM port to trigger a P1 on that port to respond with an identifying response, and what that respose should look like.

    My use case is that I have a system of P1s, and there may be dozens of COM ports in use on the computer. I want to scan over the ports, identify which ones are hosting P1s, and then I can move on to working with only those ports.

    Thanks!

    Here is a description of the serial boot sequence: https://forums.parallax.com/discussion/comment/1209149/#Comment_1209149

    The whole thread is about Serial Loaders, an there are maybe ten others. There is also a Spin code in the library that shows how to detect a propeller an load it (PropellerLoader.spin).

    Andy

    THIS is the holy grail I couldn't find. Thank you @Ariba!
Sign In or Register to comment.