Menu

#21 ethernet frame check sequence incorrect

release
open
nobody
None
1
2018-07-05
2018-07-05
Anonymous
No

Hi,
SInce the last time i wrote now all works fine. I wrote a basic BACNet application that do read and write properties to command and poll a PLC. Now i'm working on failure management. Doing some test about ethernet cable disconnection i found some troubles. If the disconnection happen after the connection is established then after the cable is plugged in command returns to work, but if i start the software with the cable unplugged things changes.
In details, wih the cable disconnected (and then with no ethernet adapter present in windows) the SW cannot establish the connection after the cable plugin due to a bad initialization of the Broadcast_Address that I've fixed in the BIP_init.c. After this fix now after the cable plugin the connection to PLC can establish but all the Write and Read commands fails without error or response from the stack. Using Wireshark i see that PLC reply to my commands but the reply is tagged by Wireshark as "ethernet frame check sequence incorrect".
At the monent my "state machine" for instance send a Read Property COmmand then wait for some response by the handler. If a timeout of 2 seconds is fired then i try to send again and so on. I see infinite retry without response and error. I use handler from the stack examples:

void Init_Service_Handlers( void )
{
Device_Init(NULL);
/ we need to handle who-is to support dynamic device binding to us /
apdu_set_unconfirmed_handler( SERVICE_UNCONFIRMED_WHO_IS, handler_who_is );

/* handle i-am to support binding to other devices */
apdu_set_unconfirmed_handler( SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind );

/* set the handler for all the services we don't implement. It is required to send the proper reject message... */
apdu_set_unrecognized_service_handler_handler( handler_unrecognized_service );

/* we must implement read property - it's required! */
apdu_set_confirmed_handler( SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property );

/* handle the data coming back from confirmed requests */
apdu_set_confirmed_ack_handler( SERVICE_CONFIRMED_READ_PROPERTY, My_Read_Property_Ack_Handler );

/* handle any errors coming back */
apdu_set_error_handler( SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler );

/* handle the ack coming back */
apdu_set_confirmed_simple_ack_handler(SERVICE_CONFIRMED_WRITE_PROPERTY, MyWritePropertySimpleAckHandler);

/* handle any errors coming back */
apdu_set_error_handler(SERVICE_CONFIRMED_WRITE_PROPERTY, MyErrorHandler);

apdu_set_abort_handler( MyAbortHandler );
apdu_set_reject_handler( MyRejectHandler) ;

}

Please let me know if I miss something.

Thanks.

Luca Leoncavallo

Discussion

Anonymous
Anonymous

Add attachments
Cancel