SerialPort problem

Hi all,

I want to implement a simple communication between TANGO and microcontroller over a serial port. MCU is programmed in a way that whenever character ‘s’ is received from UART, it will send some data.

I defined SerialLine as DeviceProperty, and named it /dev/ttyUSB0:

Then, I wrote few lines of code(lines with red dots on the left):

But, when I want to run Device Server, error is displayed in the terminal.
Can you help me to resolve the problem?

Dusan

Looks like the user with which you launch your device server does not have permission to access /dev/ttyUSB0

If you do the following from python command line you should have the same problem. It seems it has nothing to do with tango:


import serial
ser = serial.Serial('/dev/ttyUSB0', 115200)


Can you send the result of doing:

$ ls -l /dev/ttyUSB0

Sometimes it is enough to add the proper unix group to the unix user you are using to start the server.

Hi,

It looks like your device server is restarted automatically during computer startup.
I guess you configured the Starter to run it automatically at startup.
If you launch astor, you should be able to see the device servers running on your host.
If your device server is listed under a given startup level, this means the Starter will automatically start up your device server as soon as the Starter device server is started.
If you don’t want this behaviour, from astor, you should double click on the node having your computer name, then right-click on your device server and select “Set Startup Level”.
Then you should select “Controlled by Astor: No”.
Please note that you can start and stop easily your device servers from astor from the right-click menu.

Hoping this helps,
Reynald

Hi,

At the moment, I have this.

Device Server LedSensor won’t start running. It doesn’t show any mistakes neither. Is marked code from my first post OK?

And about Astro, why I don’t see TangoTest in it, even though TangoTest is running? Is it something wrong with my configuration?

On Astor, you need to double-click on “rilevostro” (or right-click → Open control panel).
Then you should see it.
If you don’t see it, double-click on “Not Controlled” on this panel to see the device servers not managed by the Starter.

Thank you.
Do you have any idea about my second problem?

Do you mean the problem with your serial port?
Do you still get the same error message after having modified the permissions on /dev/ttyUSB0?

It’s just standing like this, I dont get Ready to accept request.

I generated file with Pogo, and added those few lines from the first post.
Only I can think of is that code isn’t written well.
Do you see any mistake?

P.S. This is situation after modyfing permissions.

Do you have the same error when you try to start TangoTest device server from the command line?

This reminds me a problem we had when testing Debian 9 packages. This error was due to permission problems on mysql.proc table where some stored procedures used by Tango are defined.

Some of the stored procedures are doing a SELECT on mysql.proc and in some cases, the MySQL user used by the Database server didn’t have the permission to execute this select statement.

The file which creates the stored procedures was updated to modify this stored procedure so it should now be possible to do an equivalent select without having to grant select on mysql.proc to this user:

This change should be available in Tango 9.2.5a.
How did you install Tango?
What version are you using?

Reynald,

Sorry for late response.
I have installed Tango 9.2.5a from source code.
The situation is next. I generated new, clean code using Pogo, and when I want to start Device Server this happens:

It’s just staying like that, and I don’t get Ready to accept request.
However, I am able to start Device Servers which code is not generated with Pogo (like simple example in attachment).

I have installed pytango and ipython in virtual environment. Can this cause some problems, it’s the only thing I can think of?

Thank you,
Dusan


Extra attachments:
https://tango-controls.org/media/pybb_upload/attachments/8f516cff-34e3-4442-a9cc-be3d2eecbd80.py

Could you attach the python code generated by pogo?

Thanks

Hi,

In attachment is code generated by Pogo.
I also attached picture in which you can see basic commands, states, etc I have set.
Thank you for the help.

Hi,

I think you just need to declare at least one device for your server and to restart it.
So you can use the Server Wizard, Start the server as you did when the wizard requests it and then click on the next button.
You can then declare new devices with the wizard.
After having clicked on “Finish” button, you can restart your server.
The reinitialize server button from the wizard will make your server crash (this is a known bug with Python device servers). So you can reply “No” when the wizard proposes to reinitialize your server and you can simply kill your server manually and restart it.
After that, your device server should start and the error you were seeing related to database cache should no longer be displayed.

Hoping this helps.
Reynald

Reynald,

That helped, now it works. I stil dont get Ready to accept request though, but that’s not important, I am able to run device server. Thank you very much, you made my day.

Regards,
Dusan

Don’t worry too much about the Ready to accept request.

This is a historical problem of tango because in some old versions it was the library which provided this message and now it is the server which should provide the message.

Pogo should be generating something like:

U.server_init()
print("Ready to accept request")
U.server_run()

In fact I recommend that if you really want to use pogo, it is better to use the PythonHL because it is better maintained.