UART Unit für Linux lazarus / 32-Linux ---------------------------------------------------------------------- FPCArm · 2016-03-29 13:33 Guten Tag, ich wollte euch fragen, ob jemand von euch schon eine Unit für UART 485 Kommunikation hat. Möchte mit Pascal über Linux die UART 485 Schnittstelle verwenden. Ich habe eine Implementierung in C aber leider nicht für Pascal. Das hat doch bestimmt schon jemand übersetzt  vielen Dank schon im voraus. Beste Grüße ---------------------------------------------------------------------- mig-31 · 2016-03-30 08:18 Hi, you can operate with RS-485 as the same way as RS-232.  You can use Synaser unit from Synapse library to do it. ---------------------------------------------------------------------- DonAlfredo · 2016-03-30 08:42 In addition: If you want to drive a RS485 chip directly, you can use RTSToggle to enable/disable the driver (two wire RS485): Code: [Select]ComPort1:=TBlockSerial.Create; ComPort1.EnableRTSToggle(true);     // For driving an MAX485 directly (set send / receive on pins 2+3) If you want to use 9 bits addressing: Code: [Select]if 9bitAddressdetect then begin    ComPort1.SetParity('M');    ComPort1.Sendstring(Copy(command,1,1));// send address !!!    ComPort1.SetParity('S');    ComPort1.Sendstring(Copy(command,2,MaxInt));// send rest of command end else ComPort1.Sendstring(command); ---------------------------------------------------------------------- FPCArm · 2016-04-04 06:48 Hi guys, thanks for the response. @DonAlfredo: I will work with linux not Windows but thanks at all. @ mig-31: Has Linux a ready Lib for RS232 to use ? ---------------------------------------------------------------------- Leledumbo · 2016-04-04 07:57 Quote from: FPCArm on April 04, 2016, 08:48:38 amHi guys, thanks for the response. @DonAlfredo: I will work with linux not Windows but thanks at all. @ mig-31: Has Linux a ready Lib for RS232 to use ? Synaser from synapse, with example shown by DonAlfredo, works in both Windows and Linux. Don't get fooled by the variable name ComPort1 ---------------------------------------------------------------------- FPCArm · 2016-04-04 09:52 Ok Thank you, I will try it. I hope it works ---------------------------------------------------------------------- FPCArm · 2016-04-04 11:44 oh no, my compiler show me an error. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Free Pascal Compiler version 2.6.5 [2014/11/07] for armCopyright (c) 1993-2012 by Florian Klaempfl and othersTarget OS: Linux for ARMELCompiling pUart485.pasAssembling serialtestLinking pUart485/home/devel1/Downloads/eabi/bin/ld: warning: link.res contains output sections; did you forget -T?/home/devel1/Downloads/eabi/lib/fpc/2.6.5/units/arm- linux/rtl/cprt0.o: In Funktion `_haltproc_eabi':(.text+0x88): Nicht definierter Verweis auf `_fini'/home/devel1/Downloads/eabi/lib/fpc/2.6.5/units/arm- linux/rtl/cprt0.o: In Funktion `_haltproc_eabi':(.text+0x90): Nicht definierter Verweis auf `_init'pUart485.pas(63) Error: Error while linkingpUart485.pas(63) Fatal: There were 1 errors compiling module, stoppingFatal: Compilation aborted  In my pUart485.pas is only a empty "main" funktion, like HelloWorld example. So now I don't know what I do wrong. Has someone an idea what's wrong? ---------------------------------------------------------------------- Leledumbo · 2016-04-04 11:51 Quote from: FPCArm on April 04, 2016, 01:44:50 pmoh no, my compiler show me an error. ... Target OS: Linux for ARMEL ... Has someone an idea what's wrong? Sure you have ARMEL system instead of ARMHF? ---------------------------------------------------------------------- Thaddy · 2016-04-04 11:59 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Free Pascal Compiler version 2.6.5 [2014/11/07] for armCopyright (c) 1993-2012 by Florian Klaempfl and othersTarget OS: Linux for ARMEL You are using an idiotically old - from the date: probably compiled by yourself from a much older sourcecode branch- development version.  Which svn checkin? You don't know that revision, do you? I would first update to at least 3.0.0 which has support for both armel and armhf. armhf was unofficially introduced in fpc 2.7.1 for raspberry pi, but is since 3.0.0 officially supported. Hey, it's free software, use a) the latest stable version or b) trunk 2.6.5 is an absolute disgrace to use. I am not going to help you any further unless you show that you are using a decent and supported version. BTW: synaser included in synapse works on most platforms that FPC supports, including arm. ---------------------------------------------------------------------- FPCArm · 2016-04-04 12:44 Hi Thaddy, that is possible. I don't build the version at myself - I got it at a Forum, but I can't remember where. I only can remember that I only copi the files on my system and start the compiler with my own compiler script, to give the right parameters. I need an cross Compiler which should run on linux and compile for an arm cpu. I can't find the version what you mean. Maybe it is possible for you to give me the URL. @LEledumbo: yes I'm sure it is an AM3517 from TI. ---------------------------------------------------------------------- FPCArm · 2016-04-04 14:46 Now I got a new Crosscompiler and now it works fine. Thanks at all! ---------------------------------------------------------------------- mig-31 · 2016-04-04 14:49 Quote from: FPCArm on April 04, 2016, 02:44:43 pmI need an cross Compiler which should run on linux and compile for an arm cpu. I can't find the version what you mean. Maybe it is possible for you to give me the URL. Generally, you need to install binutils for ARM under your Linux distrubution. Download, install fpc (stale or trunk) and prepare it to cross compile for ARM.    Followed by this wiki page http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM ---------------------------------------------------------------------- Leledumbo · 2016-04-04 18:37 Quote from: FPCArm on April 04, 2016, 02:44:43 pm@LEledumbo: yes I'm sure it is an AM3517 from TI. According to the website: QuoteNEON SIMD Coprocessor and Vector Floating-Point (FP) CoprocessorSo it should be an ARMHF system, but it depends on how the OS implements the EABI. Looks like yours implement the ARMEL EABI. Nevermind if you can make it work already. ---------------------------------------------------------------------- FPCArm · 2016-04-11 12:08 I found it behind this link:  http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/ This is still fine working !