Hi,
We’re using a Cobra III (G120) to make a controllable CAN node. The CAN network contains multiple functions (diagnostics, CAN network management and various functions) and so we need multiple message handlers. Owing to the way the CAN message handler is implemented, when the CAN Message Received event is fired, the CAN messages need to read out of the receive buffer. Once this happens the CAN messages need distributing to the various message-specific handlers. In order to do this we have implemented a class which responds to the CAN received events by reading out the CAN Message Received and fires out events according to the specific handlers registered, defined by CAN Message ArbId.
To further complicate matters, the product is controllable over serial, so we also have a serial event handler.
The problem we have is that the reaction to the diagnostic CAN messages are being responded to too slowly.
This use case in our system looks like this:
Serial Link Diagnostic function request (rx)
- SerialDataReceivedEventHandler
- JNX.JNX_SerialCommands.HandleSerialRequests
- JNX.DiagnosticsHandler.RunDiagnostic
- JNX.JNX_CAN.SendMessage
- GHI.ControllerAreaNetwork.SendMessage
- CAN network (diagnostic CAN message tx)
- GHI.ControllerAreaNetwork.SendMessage
- JNX.JNX_CAN.SendMessage
- JNX.DiagnosticsHandler.RunDiagnostic
- JNX.JNX_SerialCommands.HandleSerialRequests
CAN network (diagnostic CAN message rx)
- GHI.ControllerAreaNetwork.MessageAvailable
- JNX.JNX_CAN.MessageAvailable
- JNX.DiagnosticsHandler.MessageReceived (process response)
- JNX.JNX_CAN.SendMessage
- GHI.ControllerAreaNetwork.SendMessage
- CAN network (diagnostic CAN message tx)
- GHI.ControllerAreaNetwork.SendMessage
- JNX.JNX_CAN.SendMessage
- JNX.DiagnosticsHandler.MessageReceived (process response)
- JNX.JNX_CAN.MessageAvailable
This last CAN message is taking a very long time to be sent: 1-6s!
Please can you advise where I should start searching?
One question I had was whether I could raise the GHI.ControllerAreaNetwork.MessageAvailable event handler thread priority, and also the subsequent JNX.DiagnosticHandler.MessageReceived event handler? Or would I need to set the Thread priority every time the event handler is fired?
Equally, I would like to lower the serial event handler too.
Thanks in advance,
Jason