Tango on an embedded system

I work with ESRF Grenoble team. We are happy to welcome newcomer and if possible have a better understanding of their expectations…



alexandre
France/Le Mans
Why?
I'm working on an ESRF project but before recontacting them I would be sure to understand what is tango.
Concerning this project I have not a lot of information about tango.
But what I know and what I can say, is I have 1 to 500 embedded system (which all use LPC1700) connected with a ethernet (TCP/IP connection).
The only things I have is : "TCP/IP has to be compatible with tango control system".
That's all.
So, if I can't embedded tango I have no idea what to do.
you have to write a tango class (wizard should be elaborated with POGO tool)
call it Mbed
you should define an "scalar attribute read only" : call it sensor_value
edit the generated skeleton Mbed.cpp look for "method read_sensor_value"
write c++ to read socket 3333 at ipaddr which is set a device property (see below)
assign read value to attr_sensor_value_read
that's all ! these are the only few lines of code you write on the tango side

this class is part of a C++(or python or Java app) called a DeviceServer ; use a VM for testing
while executing on the linux box, you have now a device server instance : Mbed/0
(you coud have multiple instance of the DS on the same host, or on multiple remote host)

for now, I assume you have only one running DS
this instance of device server has one class Mbed, but could encapsulate more (tango manage complexity this way ; looks like object oriented prog)

now you have 5 mbed lpc1700
these are "tango devices"
name it "lemans/lpc1700/0" …"lemans/lpc1700/4"
put acquisition software in each (you need to write as usual arm code : mbed-rtos, lwIp stack, an tcp/udp server socket) : get sensor value, make it available as a through socket server port 3333

with Jive creates in Tango DataBase these following entries :
mbed //device server
______0 //instance
_________mbed // class
______________lemans/lpc1700/0 //device addr property 192.168.01.100
______________lemans/lpc1700/1 //device addr property 192.168.01.101
______________lemans/lpc1700/2 //device
______________lemans/lpc1700/3 //device
______________lemans/lpc1700/4 //device addr property 192.168.01.104

now it is finished

to test use jive, monitor one of the device and look at attribute sensor_value
you can assigne Unit, alarms, at 0 price : no code all (almost is in tango)




runnin
Edited 9 years ago
Thank raph this is such a complete answer!

I create my Mbed class so I have all the file generated.

How can I read socket 3333 at ipaddr?

What compiler do you use?
POGO generates a Makefile (click radio button) and use g++
if you are on a (tango enabled) linux development workstation, just make
you will get an executable in DevicesServer dir

alexandre
Thank raph this is such a complete answer!

I create my Mbed class so I have all the file generated.

How can I read socket 3333 at ipaddr?

What compiler do you use?
this is what you are paid for…smile

Tango is a middleware, it deals with communication and interactions between DS and clients on the bus.
but for each DS, someone has to write the code that is related to a specific hardware : it depends on bus (USB, VME, PCI, RS232, modbus, ethernet in your case, but IMHO COM should better fit your needs for lpc1768…smile and of course, device's hardware.

so if you really need tcp/ip, you have to code a read to a tcp/ip socket client in the read_attr_sensor method
(btw, instanciation of socket took place in init_device())

on the mbed you code the server side socket
Edited 9 years ago

Hi Alexandre,

If I've to do this using tango thing I'll take following steps.

[Method 1 = RS232]

1. connect board to computer (linux/ windows) via RS232 (9 pin cable/db9. You can use descent usb to serial converter )

2. write code (in C on development board for UART0/ UART1/ whatever applicable) on board to communicate via RS232 (functions like connect( char *baud, char *devID), sendData( char* writeBuff), getData( char *readBuff), etc )

3. checked if this arrangement works on linux/ windows (writing sample program (in C++ if possible) to read/write to board using RS232)

4. once communication from board and computer is working…….
4.1. create a serial type class for tango device server (use pogo)
4.2. copy you code from sample app in appropriate classes/ or create your own serial library.
4.2.1. create commands like writeBuff( char*), readBuff( char* ), connect( char *baud, char *devID), etc).
4.2.2. once you are able to integrate all source and compile it (long and untidy process… but one walk the stony path)
4.3. if this doesn't work use this link for ready made serial class
4.4. using jive you can execute commands like connect, writeBuff, readBuff with approprate parameters.

———————–

 
Register or login to create to post a reply.