English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   support.WinUAE (http://eab.abime.net/forumdisplay.php?f=5)
-   -   Serial port problem (http://eab.abime.net/showthread.php?t=105946)

Toni Wilen 03 March 2021 17:30

- Mark and Space parity implemented (I don't know why I missed that)
- io_length = -1 CMD_WRITE support.

https://www.winuae.net/files/b/winuae.7z

Quote:

lthough it seems, the baudrate set depends on whether you choose settings first and then change to uaeserial.device or the other way round.
Enable logging and check the log. Requested settings and error conditions are logged.

amiga_amigo 03 March 2021 19:11

Wow - thanks Toni!
Do you actually still have to think while coding or are your hands typing autonomously?
Will test tonight.

amiga_amigo 03 March 2021 21:17

OK - parity tested.

Two things:
- parity Space works, Mark doesn't - it's opened as space as well.
- for enabling mark and space you currently have to set not only the io_ExtFlags but also io_SerFlags |= SERF_PARTY_ON.

According to "serial.doc" from the NDKs (1.3 to 3.5) this shouldn't be necessary:

serial.device/SDCMD_SETPARAMS:
7. If you select mark or space parity (see io_ExtFlags in serial.h),
this will cause the SERB_PARTY_ON bit to be set, and the setting
of SERB_PARTY_ODD to be ignored.

Can't test this on real hardware though.

EDIT: io_Length = -1 tested
ok - transmission stops at first occurance of 0x00 :-)

Toni Wilen 04 March 2021 18:10

- Space/Mark parity fixed.
- EOFMODE implemented. (Which no one needs?)

Quote:

Do you actually still have to think while coding or are your hands typing autonomously?
Yes.

amiga_amigo 04 March 2021 20:30

Sorry Toni - but it's not working.

This time it's parity Odd and Space that seem to be wrong.
Odd opens the port as N (both my own program and term4.8).
Space opens the port as N (my program) or E (term4.8) => ?

Don't know why this differs but this is how i understood the docs and set the flags:


Code:

SerialIO->io_SerFlags = SERF_XDISABLED; // disable XON/XOFF, clear all other bits

switch(parity)
{
case PAR_O:
        SerialIO->io_SerFlags |= SERF_PARTY_ODD; // fall-through to PAR_E!
case PAR_E:
        SerialIO->io_SerFlags |= SERF_PARTY_ON;
        break;
case PAR_M:
        SerialIO->io_ExtFlags |= SEXTF_MARK; // fall-through to PAR_S!
case PAR_S:
        SerialIO->io_ExtFlags |= SEXTF_MSPON;
        break;
}

so:

PAR_N sets no flags
PAR_O sets SERF_PARTY_ODD and SERF_PARTY_ON,
PAR_E sets SERF_PARTY_ON,
PAR_M sets SEXTF_MARK and SEXTF_MSPON (and automatically SERF_PARTY_ON),
PAR_S sets SEXTF_MSPON (and automatically SERF_PARTY_ON)

Maybe i misunderstood...?

Toni Wilen 04 March 2021 20:39

Odd parity was broken in win32 specific code (fixed now) but space and mark should work correctly.

Code:

        parity = 0;
        if (extFlags & SEXTF_MSPON) {
                parity = (extFlags & SEXTF_MARK) ? 3 : 4;
                if (!(serFlags & SERF_PARTY_ON)) {
                        put_byte_host(req + io_SerFlags, serFlags | SERF_PARTY_ON);
                }
        } else if (serFlags & SERF_PARTY_ON) {
                parity = (serFlags & SERF_PARTY_ODD) ? 1 : 2;
        }

Code:

        switch (parity)
        {
        case 1:
                dcb.Parity = ODDPARITY;
                break;
        case 2:
                dcb.Parity = EVENPARITY;
                break;
        case 3:
                dcb.Parity = MARKPARITY;
                break;
        case 4:
                dcb.Parity = SPACEPARITY;
                break;
        default:
                dcb.Parity = NOPARITY;
                break;
        }

3 = MARK, 4 = SPACE

amiga_amigo 04 March 2021 21:21

All parities ok - except Space.
Space is still the same (gives N with my program and E with Term4.8).

I'd say we both interpret the flags the same way - right?

So maybe windows specific part for Space?

EDIT:
This is the logfile entry for a transmission requesting 8S1
28-266 [2286 227-021]: uaeserial.device:1 BAUD=31250 BUF=1024 BITS=8+1 RTSCTS=0 PAR=0 XO=000000

Strange - i've put printf's into my switch-case for all branches and i do see the expected output.
So parity S should set SEXTF_MSPON (only) in my program.
How can we get parity none then?

EDIT EDIT:
Maybe got an idea:
If SEXTF_MSPON is different between my definition and yours, you'd not find that flag set when i want to set parity S. Since MSPON is the only flag i'd set, you'd think it's N requested.
Term4.8 might set SERF_PARTY_ON also (although it's set automatically). Missing SEXTF_MSPON but registering SERF_PARTY_ON, you'd think it's E requested.
But why would parity M work then? It shouldn't - so forget it...

EDIT EDIT EDIT
It shouldn't? Not true... It could, but only if the order of SEXTF_MSPON and SEXTF_MARK is reversed.
For parity M i'd set both flags. Wouldn't make a difference if you'd interpret the flags the other way round.

Just for the record:
SEXTF_MSPON == 2
SEXTF_MARK == 1
for me

amiga_amigo 05 March 2021 11:32

Ok - just tested this.
I intentionally swapped the two flags in my code for testing => all parities work as should.

You must have the bitorder of the two flags reversed!

(Please tell me i'm right, so we can close this issue...)

Toni Wilen 05 March 2021 19:21

Oops. I didn't notice MSPON and MARK was not in ascending order in header files.. fixed.

amiga_amigo 06 March 2021 10:19

Tested again - all parity settings work.

Thank you!


All times are GMT +2. The time now is 12:46.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.05600 seconds with 11 queries