I use stty to config serial port,this part is ok as far as we know
Then I use newlisp's read function (read) to read the data from serial port
most of the time,it's ok ,the data was ok and right
just a few chance, it'll get the wrong,short data, seems lost or mixed parts of
so wired
after a long time until now,I have a question, Can I really use newlisp's read to read serial port??
I doubt it myself now, I dont think linux can not handle a serial communication.
Can I use newlisp's read to read serial data for sure?
-
- Posts: 608
- Joined: Mon Feb 05, 2007 1:04 am
- Location: Abbotsford, BC
- Contact:
Re: Can I use newlisp's read to read serial data for sure?
It should work; are the read's timing out?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
Re: Can I use newlisp's read to read serial data for sure?
No timeout ,i just set it to wait the data forever to read
-
- Posts: 608
- Joined: Mon Feb 05, 2007 1:04 am
- Location: Abbotsford, BC
- Contact:
Re: Can I use newlisp's read to read serial data for sure?
Are you reading a byte at a time? And what settings are you using on the tty? What happens if you "tail -f" the tty device?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
Re: Can I use newlisp's read to read serial data for sure?
Code: Select all
root@OpenWrt:~# stty -F /dev/ttyUSB0
speed 38400 baud; line = 0;
min = 150; time = 1;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok noflsh -echoctl -echoke
for example
I read
Code: Select all
a0 ec fc 00 00 e5 c8 a0 b0 19 00 00 e5 c8 a0 fc 7f 00 00 e5 c8
now this below
Code: Select all
a8 ec fc 00 a8 b0 19 a8 fc 7f
Code: Select all
a8 ec fc 00 a8 b0 19 00 a8 fc 7f 00
and I use the same way to send data from my chip 8051 to openwrt
some times , it will be a8 ec fc 00 a8 b0 19 00 a8 fc 7f, only one "00" lost
I am so confused , because of 0xa8 is different to 0xa0? I use 0xa0,0xa8 to be the head flag of my data.
Re: Can I use newlisp's read to read serial data for sure?
I finally got this issue
if my device send 0x11 to openwrt , newlisp can not read it; 0x12 is ok ,0x01 is ok ,so else ,I could not test them all
That's why it lost data ,because the lost data is 0x11....
So wired problem...
if my device send 0x11 to openwrt , newlisp can not read it; 0x12 is ok ,0x01 is ok ,so else ,I could not test them all
That's why it lost data ,because the lost data is 0x11....
So wired problem...
-
- Posts: 608
- Joined: Mon Feb 05, 2007 1:04 am
- Location: Abbotsford, BC
- Contact:
Re: Can I use newlisp's read to read serial data for sure?
Sorry, did you mean "wierd" problem, or rather, problem with the wiring of your device? And does the data correctly show up when you run "tail -f /dev/ttyS0" ?dexter wrote:So wired problem...
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
Re: Can I use newlisp's read to read serial data for sure?
0x11 is the code for XON Resume transmission, could it be "eaten" as a flow control character?
I do not know stty but perhaps something like -ixon -ixoff or raw mode?
I do not know stty but perhaps something like -ixon -ixoff or raw mode?
Re: Can I use newlisp's read to read serial data for sure?
yeah
After I send my last reply
I know 0x11 0x13 0x0d is some CODE
now it seems working now,thanks all :)
After I send my last reply
I know 0x11 0x13 0x0d is some CODE
now it seems working now,thanks all :)