Shop OBEX P1 Docs P2 Docs Learn Events
PC serial initialization - need to emulate Propeller Tool "Identify Hardware"? — Parallax Forums

PC serial initialization - need to emulate Propeller Tool "Identify Hardware"?

I wrote a program in Purebasic running on windows which talks to my P2 device through serial port at 921600 baud asynchronous full duplex. All works fine BUT I need to initialize(?) the PC port by at least executing the "Identify Hardware" function from the Run menu in Propeller tool IDE before starting communication to my P2 device.

What is missing in my Purebasic program? Can I just emulate what the IDE does when running Identify Hardware?

Comments

  • You probably need to set the signal lines. The usual P2EVAL / PropPlug type serial ports use DTR to reset the chip, so if that line is active the chip won't respond. Ideally you toggle it with a bit of a delay to reset the chip and then talk to it.

  • @Wuerfel_21 said:
    You probably need to set the signal lines. The usual P2EVAL / PropPlug type serial ports use DTR to reset the chip, so if that line is active the chip won't respond. Ideally you toggle it with a bit of a delay to reset the chip and then talk to it.

    Cool, thanks. All I need now is a way to access DTR signal from Purebasic. It seems easy when on Linux; but I thing I'll have to use Windows API function to reach it.

  • technopoltechnopol Posts: 15
    edited 2023-02-27 21:30

    @ke4pjw said:
    @technopol
    Looks straightforward.
    https://www.purebasic.com/documentation/serialport/setserialportstatus.html

    OUch!!!!!! Now I look ridiculous. Thanks a lot, I really didn't check correctly.

  • technopoltechnopol Posts: 15
    edited 2023-02-28 01:00

    I fiddled with the DTR, didn't work. I added delays, it started to work. Then I removed the DTR toggle and only kept a Delay(142).

    It seems like I just can't talk to my board right after I opened the serial port in Purebasic, had to wait 142 ms (running @ 100MHz) and all is good!

    Thanks for the help! :)

Sign In or Register to comment.