From 4e11b1401f97292d37305aeee3dcf7573e7f5ece Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Wed, 2 Aug 2017 16:54:29 +0000 Subject: [PATCH] Refs #316. Increased XCPLOADER_CONNECT_TIMEOUT_MS from 20 to 50ms, due to SocketCAN's slower responsiveness. Shortened the wait loop in SocketCAN's interface module from 1ms to 10us to improve throughput. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@326 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- .../LibOpenBLT/port/linux/canif/socketcan/socketcan.c | 7 +++++-- Host/Source/LibOpenBLT/xcploader.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Host/Source/LibOpenBLT/port/linux/canif/socketcan/socketcan.c b/Host/Source/LibOpenBLT/port/linux/canif/socketcan/socketcan.c index af644266..262a8a67 100644 --- a/Host/Source/LibOpenBLT/port/linux/canif/socketcan/socketcan.c +++ b/Host/Source/LibOpenBLT/port/linux/canif/socketcan/socketcan.c @@ -38,6 +38,7 @@ #include /* for posix threads */ #include /* UNIX standard functions */ #include /* file control operations */ +#include /* time definitions */ #include /* I/O control operations */ #include /* network interfaces */ #include /* CAN kernel definitions */ @@ -567,8 +568,10 @@ static void *SocketCanEventThread(void *param) } } } - /* wait a little to not starve the CPU */ - UtilTimeDelayMs(1); + /* Wait a little to not starve the CPU, but not too long to prevent interference with + * data throughput. + */ + (void)usleep(10u); } /* handshake */ diff --git a/Host/Source/LibOpenBLT/xcploader.c b/Host/Source/LibOpenBLT/xcploader.c index 35c28f25..f6ef9020 100644 --- a/Host/Source/LibOpenBLT/xcploader.c +++ b/Host/Source/LibOpenBLT/xcploader.c @@ -54,7 +54,7 @@ #define XCPLOADER_CMD_PID_RES (0xFFu) /**< positive response */ /** \brief Maximum timeout for the XCP connect command. */ -#define XCPLOADER_CONNECT_TIMEOUT_MS (20u) +#define XCPLOADER_CONNECT_TIMEOUT_MS (50u) /** \brief Number of retries to connect to the XCP slave. */ #define XCPLOADER_CONNECT_RETRIES (5u)