Main Site Documentation

RS-485 driver using RLP


#1

If anyone is interested, I’ve posted the code from my RS-485 RLP driver here:

http://code.tinyclr.com/project/280/rs-485-driver-using-rlp/


#2

+1


#3

Hi Im try compile your RS-485 driver but it failed…
Im download code.bundle.lpc23xx.lpc24xx.uvision.zip
Copy irq.h, LPC23xx.h, type.h, uart.h, RLP.h to Include folder. In RLP.h enable EMX addresses.

Then Im edit makefile:


 ####################################################
 ###### Copyright(c) GHI Electronics, LLC ######
 ####################################################

OUTFILE=RLP_RS485
LINKERSCRIPT = RLP_LinkScript.lds


INCL=./include

CC		=arm-none-eabi-gcc
LD		=arm-none-eabi-gcc

CCFLAGS=  -g -mlittle-endian -mcpu=arm7tdmi  -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin -g0

LDFLAGS =-nostartfiles -Wl,--Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,--omagic
LDFLAGS+=-T $(LINKERSCRIPT)

OBJS+= RLP_RS485.o \

rebuild: clean all del_o

all: $(OBJS)
	$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm
	

RLP_RS485.o: RLP_RS485.c 
	$(CC) -c $(CCFLAGS) RLP_RS485.c -o RLP_RS485.o

clean:
	-rm *.o ./Output/*.elf ./Output/*.map

del_o:
	-rm *.o

del_map:
	-rm ./Output/*.map

Then Im open cmd and go to C:/RS485
and run make command:
C:\yagarto\yagarto-tools-20100703\bin\make.exe

I can’t run make without direct path because it start Delphi compiler. arm-none-eabi-gcc work ok.
Im try in RLP_RS485.c change #include “LPC24xx.h” to #include “LPC23xx.h” but do not help.
Oputput:


C:\RS485>C:\yagarto\yagarto-tools-20100703\bin\make.exe
rm *.o ./Output/*.elf ./Output/*.map
rm: cannot remove `*.o': No such file or directory
rm: cannot remove `./Output/*.elf': No such file or directory
rm: cannot remove `./Output/*.map': No such file or directory
make: [clean] Error 1 (ignored)
arm-none-eabi-gcc -c -g -mlittle-endian -mcpu=arm7tdmi  -Wall -I. -I./include -mapcs-frame -fno-builtin -g0 RLP_RS485.c -o RLP_RS485.o
RLP_RS485.c:2:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:3:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:4:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:5:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:6:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:7:1: warning: "/*" within comment [-Wcomment]
In file included from RLP_RS485.c:11:0:
./include/uart.h: In function 'UART0Handler':
./include/uart.h:36:27: error: expected declaration specifiers before '__irq'
./include/uart.h:37:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__irq'
In file included from RLP_RS485.c:12:0:
./include/irq.h:75:14: error: storage class specified for parameter 'sysreg'
./include/irq.h:79:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__irq'
RLP_RS485.c:24:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:25:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:26:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:28:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:45:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:46:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:48:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:67:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:68:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:70:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:75:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:76:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:78:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:85:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:86:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:87:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:88:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:90:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:101:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:102:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:103:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:105:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:121:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:122:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:123:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:125:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:130:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:131:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:132:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:134:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
RLP_RS485.c:140:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:141:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:150:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:151:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:152:1: warning: "/*" within comment [-Wcomment]
RLP_RS485.c:154:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
./include/uart.h:36:6: error: old-style parameter declarations in prototyped function definition
RLP_RS485.c:221:1: error: expected '{' at end of input
make: *** [RLP_RS485.o] Error 1

I don’t know about C anything :slight_smile:

Thanks for any help.


#4

Before starting with RLP I suggest you learn C, Make and the Linker.

RLP is for advanced users.


#5

Hi Mike,
I know that RLP is for advanced users but I need working RS485 solution for Cobra…
Im try different rs485 transceivers(MAX3485 and SN75176) but none of them do not work with cobra…
I need RS485 that I can comunicate with one device with using modbus protocol.


#6

I think you have to options here:

  1. As Mike said - learn C, Make and Linker.
  2. Or hire a professional

GHI offers paid consulting services.

Try to contact them directly.


#7

Problem is that I don’t have time to learn C :slight_smile:
I will continue use FT232R together with SN75176 because I think it will be cheaper than custom developing RS485 driver for EMX :slight_smile:
Thanks anyway.