eProsima / Micro-XRCE-DDS

An XRCE DDS implementation. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
157 stars 17 forks source link

creat session error when use serial mode #134

Open peak0924 opened 2 years ago

peak0924 commented 2 years ago

Using the example code of ShapeDemoClient, I encountered the above errors on client side.

Agent side image

ShapeDemoClient side image

peak0924 commented 2 years ago

I use xrce version 2.1.1 and serial rs232

pablogs9 commented 2 years ago

Could you paste here the whole commands you are using?

peak0924 commented 2 years ago

agent: ./MicroXRCEAgent serial -b 115200 -D /dev/ttyUSB0 -v 6 -r agent.refs client: ./ShapeDemoClient --serial /dev/ttyUSB0 。when it start I use command " create_session"

pablogs9 commented 2 years ago

Where do you have both the client and the agent running? Which serial port are you using?

peak0924 commented 2 years ago

I have Tow computer 1 computer is agent .IP 192.168.3.202 serial dev is /dev/ttyUSB0 .system is ubuntu 20.04 2 computer is client . IP 192.168.3.203 serial dev is /dev/ttyUSB0 .system is ubuntu 20.04 I use usb to serial device like this to link this tow comouter image

pablogs9 commented 2 years ago

Have you checked the proper operation of the serial link without the XRCE environment? Are you opening the port with any other software at the same moment you are running client/agent?

peak0924 commented 2 years ago

yes I have checked. client computer I use command: echo "hello" > /dev/ttyUSB0 agent computer I use command: cat /dev/ttyUSB0 . then I get "hello" at this computer

pablogs9 commented 2 years ago

Are you opening the port with any other software at the same moment you are running client/agent?

peak0924 commented 2 years ago

no

pablogs9 commented 2 years ago

client computer I use command: echo "hello" > /dev/ttyUSB0 agent computer I use command: cat /dev/ttyUSB0 . then I get "hello" at this computer

If you send something from the agent to the client-side it also works?

peak0924 commented 2 years ago

yes I just try. client-side to agent-side or agent-side to client-side are also works well

pablogs9 commented 2 years ago

How are you connecting the RS232 side of the adaptor to the Raspberry Pi?

peak0924 commented 2 years ago

1647328431(1) 798be04588fb37ae1f767255ff220fe

pablogs9 commented 2 years ago

Well it seems that the communication from the client to the agent is working since the agent creates the session but the client is not receiving the agent's session confirmation.

Please try another serial connection or use another transport layer.

peak0924 commented 2 years ago

Well it seems that the communication from the client to the agent is working since the agent creates the session but the client is not receiving the agent's session confirmation.

Please try another serial connection or use another transport layer.

UDP and TCP is works well.what is "another serial connection" RS485?

pablogs9 commented 2 years ago

UDP and TCP is works well.what is "another serial connection" RS485?

using another serial adaptor

peak0924 commented 2 years ago

UDP and TCP is works well.what is "another serial connection" RS485?

using another serial adaptor

Can you recommend me a way to build a serial port environment

pablogs9 commented 2 years ago

Try to use a USB to UART adaptor using the UART GPIO of the RPi instead of chaining two USB-to-RS232 adaptors.

ilikecola commented 2 years ago

Here is the same question on vmware virtual serial port. Agent side:

ilikecola@fastddsubuntu:~/eprosima/xrce/xrce_test$ ./MicroXRCEAgent serial -D /dev/ttyS0 -v 6 -r ../agent.refs
[1647454138.119153] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1647454138.119520] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6
[1647454147.374813] info     | Root.cpp           | create_client            | create                 | client_key: 0xAABBCCDD, session_id: 0x81
[1647454147.374880] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0xAABBCCDD, address: 1
[1647454147.374958] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0xAABBCCDD, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 

Client side:

ilikecola@fastddsubuntu:~/eprosima/xrce/bin$ ./ShapeDemoClient --serial /dev/ttyS0
Running in serial mode => dev: /dev/ttyS0
create_session
Status: NONE
l
peak0924 commented 2 years ago

https://github.com/eProsima/Micro-XRCE-DDS/issues/134#issuecomment-1069406460 @pablogs9

pablogs9 commented 2 years ago

@ilikecola could you try without virtual ports in vmware in order to check that this is not a misconfiguration on that side?

ilikecola commented 2 years ago

@pablogs9 there is a little configuration on virtual ports in vmware , only I/O mode of 'Yield CPU on poll' and echo test is working well.

pablogs9 commented 2 years ago

@ilikecola ok, could you provide detailed instructions so we can replicate your scenario?

ilikecola commented 2 years ago

OK Step 1. set up two VM based on ubuntu 20.04 and upload libs and execs Step 2. add serial ports in these VM with 'Yield CPU on poll' checked Step 3. do Echo test to comfirm serial port working. Step 4. executing 'MicroXRCEAgent' on server side and executing 'ShapeDemoClient' on client sid Snipaste_2022-03-17_17-24-45 e