Page 1 of 1
ST time between frames
Posted: Mon 17. Jun 2024, 07:35
by sandeepc
Hi,
we are using PEAK CAN ISO TP API, to exchange data between in Host and ECU it will be in MB, for this application i can able to transmit and receive data.
But peak API as nor sending as ECU mentioned FC frame.
If ECU sends an FC with ST time 500micro seconds but PEAK(host) sending each frame in the range of 1 to 2msec always. so this delay is causing adding to much time for data transmission to the ECU.
So how can i reduce the these time?
here i attached image with an example.
i tried with configuring the these parameters.
PCANTP_PARAMETER_SEPARATION_TIME_TX,PCANTP_PARAMETER_SEPARATION_TIME did not work.
Re: ST time between frames
Posted: Wed 19. Jun 2024, 16:15
by F.Vergnaud
Hello,
Sorry if I rephrase you post but I need to be sure that I correctly understand your use-case (feel free to correct me if I'm mistaken):
- Your application is sending data to the ECU.
- The ECU is configured with a separation time (STMin) of 0xF5 (500µs) and block size (BS) of 64 (note: I counted 62? on your screenshot).
First thing to be aware of is that handling precision below 1ms on Windows system is not guaranteed. STmin in the range of 100µs to 900µs are hard to match perfectly.
You also need to consider if you are using a USB or PCI device, USB devices may have an increased latency due to the USB protocol.
To ensure Minimum Separation Time requirement, the PCAN-ISO-TP API relies on echo messages (a.k.a. self-receive messages) to assert that a consecutive frame is physically written on the CAN bus before queueing the next consecutive frame. This fact is the reason why it is hard to match the STmin value. However you can configure 2 parameters to improve the performances:
1. The parameter PCANTP_PARAMETER_SELFRECEIVE_LATENCY allows to make optimizations on the queueing mechanism:
- By default this parameter is set to PCANTP_SELFRECEIVE_LATENCY_LIGHT: fragmented self-receive frame mechanism is ignored when STmin is set to 0xF3 and lower (<300µs).
- PCANTP_SELFRECEIVE_LATENCY_OPTIMIZED enables a mechanism to predict the time to effectively write frames on bus and to queue the next message slightly before receiving the echo message. Beware that this prediction mechanism depends on the bus load and can lead to sending consecutive frames slightly before the required separation time.
Changing this parameter is not recommended.
2. You can use parameter PCANTP_PARAMETER_SEPARATION_TIME_TX to ignore and override the STmin value given by the ECU. In your case, you should set it to 0xF3 or below to enter the mode where the API does not rely on echo messages. You could even consider trying to set PCANTP_PARAMETER_SEPARATION_TIME_TX to 0:
- writing a 11 bit CAN frame of 8 bytes at 500kbps is about 300µs,
- ECU are often capable of handling consecutive frames slightly below their STmin.