kenta-shimizu / pysemisecs

This package is SEMI-SECS-communicate implementation on Python3.
Apache License 2.0
31 stars 12 forks source link

Host/Tool Serial Communication Issue #6

Closed jmackos closed 4 months ago

jmackos commented 7 months ago

Error

kenta-shimizu commented 7 months ago

Hi, Just to confirm, 'is_master' is False ?

Judging from the log, equip appears to be in MASTER mode. host must be in SLAVE mode. ('is_master' is False)

'is_master' can be set by constructor parameter or is_master property.

If 'is_master' is False, 'Secs1OnPySerialCommunicator' has some problem that I can't find.

Best regards.

jmackos commented 7 months ago

I have tried both is_master = True and is_master = False. Same issue occurs.

I plan to test adding a shared_state variable that gets set to 'COMMUNICATING' whenever there are bytes read from the buffer.

It will bet set to 'IDLE' after the host or tool sends an ACK byte. Signals the end of a communication.

Then any command issued by the host (S1F3) to the equipment will check and wait for 'IDLE' prior to initiating a send.

Using it as an extra check to hopefully prevent the issue.

jmackos commented 7 months ago

That fix did not work. I attempted to strip out all my database logging and make it really simple program.

i used the TCPIP communicator too. Same issue arises. Even on the simplified program.

this is what it looked like…

if name == 'main':

print('hello world...')
gem_MODEL = 'MDLN-TOKYO'
gem_SoftRev = '001'

# Create a GUI to setup the communicator
serial_or_hsms = InputFormChooser()
serial, tcpserial, hsms = serial_or_hsms.get_values()
if serial == True:
    dp, br, di, ie, im, t1, t2, t3, t4 = InputFormSerial().get_values()
    host = Secs1OnPySerialCommunicator(port=dp,baudrate=int(br),device_id=int(di),is_equip=ie,is_master=im,timeout_t1=float(t1),timeout_t2=float(t2),timeout_t3=float(t3),timeout_t4=float(t4),gem_mdln=gem_MODEL,gem_softrev=gem_SoftRev,gem_clock_type=ClockType.A16,name='host')

elif hsms == True:
    ip, p, si, ie, t3, t5, t6, t8 = InputFormHSMS().get_values()
    host = HsmsSsActiveCommunicator(ip_address=ip,port=int(p),session_id=int(si),is_equip=ie,timeout_t3=float(t3),timeout_t5=float(t5),timeout_t6=float(t6),timeout_t8=float(t8),gem_clock_type=ClockType.A16,name='host')

else:
    ip, p, si, im, ie, t1, t2, t3, t4 = InputFormTCPSerial().get_values()
    host = Secs1OnTcpIpCommunicator(ip_address=ip,port=int(p),device_id=int(si),is_equip=ie,is_master=im,timeout_t1=float(t1),timeout_t2=float(t2),timeout_t3=float(t3),timeout_t4=float(t4),gem_clock_type=ClockType.A16,name='host')

# Creates Listeners for monitoring H<->E Communication
host.add_recv_all_msg_listener(_recv_msg)
host.add_sended_msg_listener(_sended_msg)
host.add_error_listener(_error)

CommandCenterGUI()  # the host connection is opened in this GUI

# Close the GUI and let this run
while True:
    host.send_sml('S1F1 W <L <I2 1><I2 2><I2 3><I2 4><I2 5><I2 6><I2 7><I2 8><I2 9><I2 10><I2 11><I2 12><I2 13><I2 14><I2 15><I2 16>>.')
    time.sleep(1)