Tous les messages de ce fil
Message n 1 de ce fil
De :Doublehp (dhp@doublehp.org)
Objet :Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded, alt.microcontrollers.8bit, comp.programming
Date :2004-02-23 15:43:39 PST
This message is related with

http://groups.google.fr/groups?dq=&hl=fr&lr=&ie=UTF-8&threadm=1076050956.639555%40excalibur.osa.com.au&prev=/groups%3Fdq%3D%26num%3D25%26hl%3Dfr%26lr%3D%26ie%3DUTF-8%26group%3Dalt.microcontrollers.8bit%26start%3D25

I received from motorola the following answer:
"This customer use Linux and have trouble to send 0x0A or 0x0D, this
is due
to his Linux I/O driver. Metrowerks CodeWarrior for HC08 is run under
Windowes OS and it 
works fine on 908JB8 without any trouble on send 0x0A or 0x0D down."


can someone untar http://demaine.free.fr/monitor_68hc08/src/ read the
file rs232.c and try to find whats wrong between lines 49 to 71 ?

I really dont understand what could make opening the port in a wrong
mode ...

You dont really need to comile ... just read my last post, my logbook
p29 and my source file.

Thanks for any help
Message n 2 de ce fil
De :Michael Anton (manton@nocompusmart.spamab.ca)
Objet :Re: Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded, alt.microcontrollers.8bit, comp.programming
Date :2004-02-23 18:28:54 PST
You may need to specify the translation mode as binary, as  I'm not sure
what
the default translation mode under Linux is.

Mike Anton


"Doublehp" <dhp@doublehp.org> wrote in message
news:71c62763.0402231543.2e2f8145@posting.google.com...
> This message is related with
>
> http://groups.google.fr/groups?dq=&hl=fr&lr=&ie=UTF-8&threadm=1076050956.639555%40excalibur.osa.com.au&prev=/groups%3Fdq%3D%26num%3D25%26hl%3Dfr%26lr%3D%26ie%3DUTF-8%26group%3Dalt.microcontrollers.8bit%26start%3D25
>
> I received from motorola the following answer:
> "This customer use Linux and have trouble to send 0x0A or 0x0D, this
> is due
> to his Linux I/O driver. Metrowerks CodeWarrior for HC08 is run under
> Windowes OS and it
> works fine on 908JB8 without any trouble on send 0x0A or 0x0D down."
>
>
> can someone untar http://demaine.free.fr/monitor_68hc08/src/ read the
> file rs232.c and try to find whats wrong between lines 49 to 71 ?
>
> I really dont understand what could make opening the port in a wrong
> mode ...
>
> You dont really need to comile ... just read my last post, my logbook
> p29 and my source file.
>
> Thanks for any help
Message n 3 de ce fil
De :Doublehp (doublehp@doublehp.org)
Objet :Re: Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded, alt.microcontrollers.8bit, comp.programming
Date :2004-02-24 14:49:48 PST
dhp@doublehp.org (Doublehp) wrote in message news:<71c62763.0402231543.2e2f8145@posting.google.com>...

after 2h of chat on IRC, someone said me that i forgot to enter
nonOPOST mode, so I added line 70 with the proper line as described on
http://www.easysw.mike/serial/serial.html

/* canonical raw input */
        vars->serial->c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
        vars->serial->c_lflag &= ~OPOST;
        vars->serial->c_cflag |= (CS8); /* use 8bit data */
//      term_prop->c_cflag |= (CLOCAL | CREAD); 
        tcsetattr(fd, TCSAFLUSH, vars->serial);

but I still had the same bug ... so that people offered that very
horrible hack:
I put 

        sprintf(stty,"stty -a < %s",vars->device);
        system(stty);

after tcsetattr

Q: why isnt the line with ~OPOST enough ???
Message n 4 de ce fil
De :Brian Dean (bsd@bdmicro.com)
Objet :Re: Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded
Date :2004-02-24 16:49:05 PST
On Tue, Feb 24, 2004 at 02:49:47PM -0800, Doublehp wrote:

>         vars->serial->c_lflag &= ~OPOST; 
> but I still had the same bug ... so that people offered that very
> horrible hack:
> I put 
> 
>         sprintf(stty,"stty -a < %s",vars->device);
>         system(stty);
> 
> after tcsetattr
> 
> Q: why isnt the line with ~OPOST enough ???

OPOST needs to be applied to c_oflag (output modes), not c_lflag
(local modes).

Cheers,
-Brian
-- 
Brian Dean, bsd@bdmicro.com
BDMICRO - MAVRIC & MAVRIC-II ATmega128 Based Dev Boards
http://www.bdmicro.com/
Message n 5 de ce fil
De :Doublehp (doublehp@doublehp.org)
Objet :Re: Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded
Date :2004-02-25 17:03:01 PST
Brian Dean <bsd@bdmicro.com> wrote in message news:<20040225004900.GA97680@vm.bdmicro.com>...
> On Tue, Feb 24, 2004 at 02:49:47PM -0800, Doublehp wrote:
> 
> >         vars->serial->c_lflag &= ~OPOST; 
> > but I still had the same bug ... so that people offered that very
> > horrible hack:
> > I put 
> > 
> >         sprintf(stty,"stty -a < %s",vars->device);
> >         system(stty);
> > 
> > after tcsetattr
> > 
> > Q: why isnt the line with ~OPOST enough ???
> 
> OPOST needs to be applied to c_oflag (output modes), not c_lflag
> (local modes).
> 
> Cheers,
> -Brian

You are right. Thank you all of you for your help
Message n 6 de ce fil
De :Wim Lewis (wiml@underhill.hhhh.org)
Objet :Re: Cant open serial port properly ... I dont understand whats wrong ...
 
View this article only
Groupes de discussion :comp.arch.embedded, alt.microcontrollers.8bit, comp.programming
Date :2004-02-25 17:03:12 PST
In article <f4a4c456.0402241449.e786425@posting.google.com>,
Doublehp <doublehp@doublehp.org> wrote:
>after 2h of chat on IRC, someone said me that i forgot to enter
>nonOPOST mode, so I added line 70 with the proper line as described on
>http://www.easysw.mike/serial/serial.html
>
>/* canonical raw input */
>        vars->serial->c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

Actually, this is setting *non*canonical input (turning off ICANON). 
"Canonical" input means translating the terminal's idea of CR into
Unix's idea (0x0A). By default, the serial port is configured to
talk to a terminal, so flags like that are turned on.

See "man termios" for all the gory details. Yo ucan probably get what
you want with "raw" mode: call tcgetattr(), cfmakeraw(), and then
tcsetattr() to apply the modified attributes back onto the serial device.
cfmakeraw() does almost the same thing you're doing in the code snippet
you posted, except it modifies a few more flags.

-- 
      Wim Lewis <wiml@hhhh.org>, Seattle, WA, USA. PGP keyID 27F772C1

2004 Google