Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-11

serial port access problem in arm-linux-uclibc-

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Nataraj S Narayan

Hi

The following code works well in i386, but not on
arm-linux-uclibcgnueabi- , on at91sam9263ek SBC.

{$mode objfpc}
{$LONGSTRINGS OFF}
Program ttt2;
uses serial;

{nterface}

Type
 DataBuffer_typ= array[0..9] of char;

{mplementation}

var
mySerial : Longint;
myStr	 : DataBuffer_typ  ;
   i	 : integer;
begin
{   SetLength(myStr,10);}
   mySerial:=seropen('/dev/ttyS1');
   SerSetParams(mySerial,115200,8,NoneParity,1,[]);
   SerRead(mySerial,myStr[0],1);
   write(myStr[0]);
end.

The SBC and PC communicate well when using minicom.

I compile the code for arm-linux using :-

# /usr/fpc-uclibc/lib/fpc/2.5.1/ppcrossarm -MObjFPC -TLinux -Parmv5 -gl -Xd -Xs -l -darm -XParm-linux-uclibcgnueabi- -CfSOFT -CaEABI -darm -gl -O- -CpARMV5 -uUSE_LOCALIZE
-Fu/software/fpc-uclibc/lib/fpc/2.5.1/units/arm-linux/* -FL/usr/br-git-rf/lib/ld-uClibc.so.0 -XR/usr/br-git-rf/ -Fl/usr/br-git-rf/lib -Fl/usr/br-git-rf/usr/lib
-k"--sysroot=/usr/br-git-rf" ttt2.pas

Where do i start checking ?

regs
Nataraj

Reply by email

Henry Vermaak
to Nataraj S Narayan

2009/11/18 Nataraj S Narayan :

Show quoted text 44 lines
Hi The following code works well in i386, but not on arm-linux-uclibcgnueabi- , on at91sam9263ek SBC. {$mode objfpc} {$LONGSTRINGS OFF} Program ttt2; uses serial; {nterface} Type  DataBuffer_typ= array[0..9] of char; {mplementation} var mySerial : Longint; myStr    : DataBuffer_typ  ;   i     : integer; begin {   SetLength(myStr,10);}   mySerial:=seropen('/dev/ttyS1');   SerSetParams(mySerial,115200,8,NoneParity,1,[]);   SerRead(mySerial,myStr[0],1);   write(myStr[0]); end. The SBC and PC communicate well  when using  minicom. I compile the code for arm-linux using :- #  /usr/fpc-uclibc/lib/fpc/2.5.1/ppcrossarm -MObjFPC -TLinux -Parmv5 -gl -Xd -Xs -l -darm -XParm-linux-uclibcgnueabi- -CfSOFT -CaEABI -darm -gl -O- -CpARMV5  -uUSE_LOCALIZE -Fu/software/fpc-uclibc/lib/fpc/2.5.1/units/arm-linux/* -FL/usr/br-git-rf/lib/ld-uClibc.so.0 -XR/usr/br-git-rf/ -Fl/usr/br-git-rf/lib  -Fl/usr/br-git-rf/usr/lib -k"--sysroot=/usr/br-git-rf" ttt2.pas Where do i start checking ?

What goes wrong? You don't seem to check any return values?

Henry

Reply by email

Nataraj S Narayan
to Henry Vermaak

Henry

The following in FreeBSD i386:-

 mySerial:=seropen('/dev/cuad0');
   SerSetParams(mySerial,115200,8,NoneParity,1,[]);
   i:=SerRead(mySerial,myStr[0],1);
   write(myStr[0]);
   writeln(i);

Gives me the character i typed from other end (minicom) and '1'. Of course, i get one char at a time for each run.

One arm, getting zero always.

regards

Nataraj

Henry Vermaak wrote 53 lines
2009/11/18 Nataraj S Narayan : > Hi > > The following code works well in i386, but not on > arm-linux-uclibcgnueabi- , on at91sam9263ek SBC. > > {$mode objfpc} > {$LONGSTRINGS OFF} > Program ttt2; > uses serial; > > {nterface} > > Type > DataBuffer_typ= array[0..9] of char; > > {mplementation} > > var > mySerial : Longint; > myStr : DataBuffer_typ ; > i : integer; > begin > { SetLength(myStr,10);} > > mySerial:=seropen('/dev/ttyS1'); > SerSetParams(mySerial,115200,8,NoneParity,1,[]); > SerRead(mySerial,myStr[0],1); > write(myStr[0]); > > end. > > The SBC and PC communicate well when using minicom. > > I compile the code for arm-linux using :- > > # /usr/fpc-uclibc/lib/fpc/2.5.1/ppcrossarm -MObjFPC -TLinux -Parmv5 > -gl -Xd -Xs -l -darm -XParm-linux-uclibcgnueabi- -CfSOFT -CaEABI -darm > -gl -O- -CpARMV5 -uUSE_LOCALIZE > -Fu/software/fpc-uclibc/lib/fpc/2.5.1/units/arm-linux/* > -FL/usr/br-git-rf/lib/ld-uClibc.so.0 -XR/usr/br-git-rf/ > -Fl/usr/br-git-rf/lib -Fl/usr/br-git-rf/usr/lib > -k"--sysroot=/usr/br-git-rf" ttt2.pas > > Where do i start checking ? What goes wrong? You don't seem to check any return values? Henry _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email