Project

General

Profile

Communication EGD or ModBus/TCP Cores

Added by Hector Bojorquez over 5 years ago

Hi,

I'm a beginner with FPGA and embedded systems, now I'm creating a communication between some devices and the MitySOM1810 through EGD and ModBus/TCP communication protocols.

After this stage we are thinking about implementing the communication protocol in the Spartan 6 or if it is possible, a big part of all the application.

If some of you could give me some advices about, it would help me a lot.

1.- Is it possible to implement the ModBus or EGD protocol in the FPGA?

2.- Are there existing cores for the Spartan 6 that could work with these protocols?

Please any comment or advice would help a lot, feel free to sharing me your personal opinions.

Have a great day,

Hector.


Replies (16)

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Hector Bojorquez wrote:

Hi,

I'm a beginner with FPGA and embedded systems, now I'm creating a communication between some devices and the MitySOM1810 through EGD and ModBus/TCP communication protocols.

After this stage we are thinking about implementing the communication protocol in the Spartan 6 or if it is possible, a big part of all the application.

If some of you could give me some advices about, it would help me a lot.

1.- Is it possible to implement the ModBus or EGD protocol in the FPGA?

Most likely it is possible, though i'm only briefly aware of how Modbus works and don't know EGD.

2.- Are there existing cores for the Spartan 6 that could work with these protocols?

Don't think we have dealt with any. A brief google search doesn't show much other than this dissertation.
http://www.dissertationtopic.net/doc/283774

Please any comment or advice would help a lot, feel free to sharing me your personal opinions.

Have a great day,

Hector.

RE: Communication EGD or ModBus/TCP Cores - Added by Alexander Block over 5 years ago

Hector,

I spoke with Jon C. about this issue and we have a little more followup.

In the past for the MitySOM/DSP-L138 family of modules we have utilized Modbus/TCP however it was implemented on the ARM processor in Linux using the libmodbus library. We have done Modbus implementations on other processor platforms as well but never in the FPGA itself. If you have a reason to implement it in the FPGA we unfortunately don't have guidance at this time.

There is a 5 year old Modbus FPGA core from OpenCores however we have no experience with it.

We have never implemented EGD to my knowledge.

Thank you,

Alex

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

Hi Jonathan and Alex,

It is really helpful information, thank you.

I did not know about libmodbus library, now I'm trying to use it but it looks like the compiler is not linking correctly the modbus library, I added the library path in the Include Directories in Eclipse, but it still

not working, I got an advice about "undefined reference to 'modbus_new_tcp' ", I searched in the Internet and I found a Forum post about, they talk about a solution in the Reply #16.

Did you have the same issue?

About the FPGA programming, we are thinking about getting Vivado software, Can you suggest me other options to consider about?

Thanks!

Hector.

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Hector Bojorquez wrote:

Hi Jonathan and Alex,

It is really helpful information, thank you.

I did not know about libmodbus library, now I'm trying to use it but it looks like the compiler is not linking correctly the modbus library, I added the library path in the Include Directories in Eclipse, but it still

not working, I got an advice about "undefined reference to 'modbus_new_tcp' ", I searched in the Internet and I found a Forum post about, they talk about a solution in the Reply #16.

Did you have the same issue?

Did you add the library to the linker? See the following link for how we add the dsplink.lib file. https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/DSP_Hello_World#Compiling-for-the-ARM

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

I added the library and its path, but I did not get any .lib file after the library installation, Should I have a .lib file?

I only got some "modbus..".h files and one .pc file

RE: Communication EGD or ModBus/TCP Cores - Added by Alexander Block over 5 years ago

Hector,

Concerning the Vivado question:

At this time we do not recommend using Vivado as it does not support the Spartan 6 based devices. We recommend Xilinx ISE 14.X and frankly to begin with you can start with their free webpack versions until you need to implement chipscope or other features of the paid version.

https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/FPGA_Overview

Hope this helps,

Alex

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

Hi,

Well I have .so and a .la file, the dinamic library and the static library used by the GNU "libtools" package.

I tried to add the libmodbus with the .so file to the linker following the wiki for adding dsplink.lib file https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/DSP_Hello_World#Compiling-for-the-ARM

All the "undefined reference to 'modbus...." advices gone, but in the console messages I got " /usr/local/lib/libmodbus.so: could not read symbols: File in wrong format " In this forum some ones suggest that it maybe is for an incompatibility of 32/64 bit systems

and they suggest to compile the program with a special CXXFLAGS to make it compatible. Can I make the Building of the project using Terminal commands? for then, try to apply the suggested solution.

Hector/

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Where did you get this error? When running the program on the L138?

The error usually indicates the object was built for a different architecture or using a different toolchain. You can use the file command to verify if it was properly built. You want to make sure it states ARM and not x86 or x64.

For example

 $ file libpcre.so.0.0.1 
libpcre.so.0.0.1: ELF 32-bit LSB  shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped

I don't believe that you should need any special CXXFlAGS, my first step would be to make sure you use the same compiler to build both library and executable.

It would help if you attached your build logs for the library and the app.

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

I got the error in Eclipse Console messages I have not tried on the MitySOM, I tried the $file command and it looks good
Checking compatibility

I want to share you the Library installation log, it is attached, the installation created some folders but the one indicated as the principal is /urs/local/lib in this folder are located the .la and the .so files among others

So I tried to configure project properties in Eclipse, first the Directories
Conf_Directories

Then the libraries

And finally the Miscellaneous

And when I try to build the project I don't get any Error in the "Problems" label in Eclipse, I only get the Building error in the Console log

Console log  -Error- File in wrong format

Console_log.PNG (23.3 KB) Console_log.PNG Console log -Error- File in wrong format
Directories.PNG (50.9 KB) Directories.PNG Conf_Directories
File_Command.PNG (15 KB) File_Command.PNG Checking compatibility
Lib_folder.PNG (60.5 KB) Lib_folder.PNG
libmodbus_pc.PNG (11.3 KB) libmodbus_pc.PNG
Libraries.PNG (55.3 KB) Libraries.PNG
Migration_folder.PNG (15.4 KB) Migration_folder.PNG
installationLog.txt (2.98 KB) installationLog.txt ***** ModbusLibrary Installation Log ******
Miscellaneous.PNG (45.8 KB) Miscellaneous.PNG
modbus_folder.PNG (13.9 KB) modbus_folder.PNG

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Hector Bojorquez wrote:

I got the error in Eclipse Console messages I have not tried on the MitySOM, I tried the $file command and it looks good

This shows that the object file your trying to use was built of an intel processor. Not for the ARM L138 processor.

I want to share you the Library installation log, it is attached, the installation created some folders but the one indicated as the principal is /urs/local/lib in this folder are located the .la and the .so files among others

The files located in /lib, /usr/lib, and /usr/local/lib are supposed to be compiled for the linux VM. You don't want to run the plain make install when you are cross compiling as it will install the libraries to the linux system.

So I tried to configure project properties in Eclipse, first the Directories

Then the libraries

And finally the Miscellaneous

And when I try to build the project I don't get any Error in the "Problems" label in Eclipse, I only get the Building error in the Console log

It looks like you ran the ./configure without setting it up for the crosscompile. See below. Note if you grabbed the tarball instead of using git then you should be able to skip the git and the autogen.sh command. Also note the --host provided to configure, this should match your cross compiler. Also notice the DESTDIR= added to make install, this ensures the files are copied to the current directory/ARM. See the build log for what gets placed in this ARM folder.

git clone git://github.com/stephane/libmodbus
cd libmodbus/
. /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-gnueabi
./autogen.sh
./configure --host=arm-angstrom-linux-gnueabi
make
make install DESTDIR=$PWD/ARM

See my build log libmodbus_build.log

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

Jonathan,

I used the tarball instead of the git, I share you my log, it is different than yours, it is attached.

I can see some Errors. After this Should I be able to compile in Eclipse using the library ?

Thanks,

Hector

MyLog.txt (13.8 KB) MyLog.txt This is my installation log

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Looks like you are using the older toolchain which apparently doesn't have the rpl_* support. This post gives some possible solutions.
https://www.linuxquestions.org/questions/linux-software-2/undefined-reference-to-%60rpl_malloc'-587256/

However I'd recommend installing the newer "Aug-2012 SDK Tarball" from https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/GCC_Toolchain. This will ofcourse require you to be running the newer MDK on the L138 since it switches from gcc 4.3.3 to 4.5.4.

You can follow this guide if you need to update to the newest MDK. https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Updating_devkit_to_latest_MDK

RE: Communication EGD or ModBus/TCP Cores - Added by Hector Bojorquez over 5 years ago

How can I check my currently devkit MDK?

RE: Communication EGD or ModBus/TCP Cores - Added by Jonathan Cormier over 5 years ago

Good question, I'm not sure if there are any files on there that specify which version it is. But if nobody has updated it since you bought it then it will be running the older MDK filesystem.

    (1-16/16)
    Go to top
    Add picture from clipboard (Maximum size: 600 MB)