Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1610670pxj; Fri, 18 Jun 2021 10:44:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwllzAhGa5+JGfPRe4jHjSdvkOVt9iaFiLsN4iA6aOdFhqeRiaIr7NT1FDBaYTf9WFsoAK0 X-Received: by 2002:a05:6402:510c:: with SMTP id m12mr6981298edd.126.1624038292559; Fri, 18 Jun 2021 10:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624038292; cv=none; d=google.com; s=arc-20160816; b=pFppaL9uID41WfvUG9GcTmgF3Ou+ZraRbhBMC+uSz/ueXikAWCjdN+368KLhqmSfUY pzwfn6MCMJaJUtLzhxqeUkn2OsxqikyzUtPL66l0n4PfzyzZY4kzvbOZwfknGPHLumwr Ya8LO1YT5qn0jaYt6BVge5zn6+zhuvOI/pk/POOU3wAvjBdejM+JF/SAmi7fX1QSVx4q PDRzXN2azEqGDxEU1t4w8ybkpbdGiqzthhmzTtmADhGgZoego/WUicfc3fYXzqkjuIsJ O5GGY5xTx2I5i75b1OjVbaTN2XlXAkIz81iSW8npMN0xquALHdJ1Z59YJJreBhDFhC2L dxRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=E40IwuYS9e6GN1aaEb1+G0+ptf1ACcyXGnx0eywkKVg=; b=uOuVmDQie1lyXncs2DFbxDwpqL4OaLGN4u8Yea+I/5rpVMBgqEc6ddYFN6ZAiIecX2 UKVp3c2Q6/e/rCrWKf5Lhz8YxuM8Y4MJGPXFJ1uzV8z5WvQs+R9Hx3c6J+nSAMGhs8UI BfLjgkCdsiswjHM8p4+rE7WIbbJJRZ1/nUw2LLvYr6LcHdWrgRbeXfAXYx08atj91FnH H3ClvEMGaChawH59PupR4TRLp7qQi4+QxiA3FxHZY+jFt9gjgHEJ1ZtLK0xfypPgVxfe 39kurjMt14z565FntmfK3nK7wKXKEydIamQQ6CYUiZu+I/h/zxRZmzDSxWQ37kaBJY1H 1Gdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id og34si3111909ejc.662.2021.06.18.10.44.28; Fri, 18 Jun 2021 10:44:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbhFROaP convert rfc822-to-8bit (ORCPT + 99 others); Fri, 18 Jun 2021 10:30:15 -0400 Received: from mail-lj1-f180.google.com ([209.85.208.180]:44641 "EHLO mail-lj1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbhFROaO (ORCPT ); Fri, 18 Jun 2021 10:30:14 -0400 Received: by mail-lj1-f180.google.com with SMTP id d2so14288161ljj.11; Fri, 18 Jun 2021 07:28:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UBoh1jmBuVPR6JwKtiqhFyNi/ivq1pysrv5qHXiGQLQ=; b=M2WlcGE9gyLdpSSoi3B2hIDn9eGDMoJLpujGGzM61l4d6oAj9rxa3SBspsCdEwwhcc P8P+S9Ds9vzyP44M8M8RvOeZ+ZoJoHriHwick8pXH69Zt5WI71YHjR7e2RBHxkFlinV1 TPkLtxLtMxYKK4GRsIW23K88fr837jsVuzHDW3ujIYl9AxongYTuHYzi6R8DO2WPTnUD A1eLhV82nHoqTOxLB/n8vJKeRh2bUaCZ8gLf4HC2xyh812MoRVWR20fbTbSVnXFkMOCd +sBgR8qilaO+xI+8j65cJX1GNSCD+rBVe9KFErFRtLRcdtIs4D1bXstXf7r6z8EkiVdu Lrgg== X-Gm-Message-State: AOAM530b0vxM5tF5FHT99k07161PY5NMAzKY8yI3qpJJ1GFZMEL0JsUN +r6enbd0VBIa0ZKPMd4+LvIN2SDNeggkO/eeQt8= X-Received: by 2002:a2e:9016:: with SMTP id h22mr7590517ljg.331.1624026483866; Fri, 18 Jun 2021 07:28:03 -0700 (PDT) MIME-Version: 1.0 References: <20210603151550.140727-1-mailhol.vincent@wanadoo.fr> <20210603151550.140727-3-mailhol.vincent@wanadoo.fr> <20210618093424.xohvsqaaq5qf2bjn@pengutronix.de> <20210618124447.47cy7hyqp53d4tjh@pengutronix.de> In-Reply-To: <20210618124447.47cy7hyqp53d4tjh@pengutronix.de> From: Vincent MAILHOL Date: Fri, 18 Jun 2021 23:27:52 +0900 Message-ID: Subject: Re: CAN-FD Transmitter Delay Compensation (TDC) on mcp2518fd To: Marc Kleine-Budde Cc: linux-can , netdev , open list , Oliver Hartkopp , Thomas Kopp Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri. 18 Jun 2021 at 21:44, Marc Kleine-Budde wrote: > On 18.06.2021 20:17:51, Vincent MAILHOL wrote: > > > > I just noticed in the mcp2518fd data sheet: > > > > > > > > | bit 14-8 TDCO[6:0]: Transmitter Delay Compensation Offset bits; > > > > | Secondary Sample Point (SSP) Two’s complement; offset can be positive, > > > > | zero, or negative. > > > > | > > > > | 011 1111 = 63 x TSYSCLK > > > > | ... > > > > | 000 0000 = 0 x TSYSCLK > > > > | ... > > > > | 111 1111 = –64 x TSYSCLK > > > > > > > > Have you takes this into account? > > > > > > I have not. And I fail to understand what would be the physical > > > meaning if TDCO is zero or negative. > > The mcp25xxfd family data sheet says: > > | SSP = TDCV + TDCO > > > > TDCV indicates the position of the bit start on the RX pin. > > If I understand correctly in automatic mode TDCV is measured by the CAN > controller and reflects the transceiver delay. Yes. I phrased it poorly but this is what I wanted to say. It is the delay to propagate from the TX pin to the RX pin. If TDCO = 0 then SSP = TDCV + 0 = TDCV thus the measurement occurs at the bit start on the RX pin. > I don't know why you want > to subtract a time from that.... > > The rest of the relevant registers: > > | TDCMOD[1:0]: Transmitter Delay Compensation Mode bits; Secondary Sample Point (SSP) > | 10-11 = Auto; measure delay and add TDCO. > | 01 = Manual; Do not measure, use TDCV + TDCO from register > | 00 = TDC Disabled > | > | TDCO[6:0]: Transmitter Delay Compensation Offset bits; Secondary Sample Point (SSP) > | Two’s complement; offset can be positive, zero, or negative. > | 011 1111 = 63 x TSYSCLK > | ... > | 000 0000 = 0 x TSYSCLK > | ... > | 111 1111 = –64 x TSYSCLK > | > | TDCV[5:0]: Transmitter Delay Compensation Value bits; Secondary Sample Point (SSP) > | 11 1111 = 63 x TSYSCLK > | ... > | 00 0000 = 0 x TSYSCLK Aside from the negative TDCO, the rest is standard stuff. We can note the absence of the TDCF but that's not a blocker. > > > If TDCO is zero, the measurement occurs on the bit start when all > > > the ringing occurs. That is a really bad choice to do the > > > measurement. If it is negative, it means that you are measuring the > > > previous bit o_O !? > > I don't know... > > > > Maybe I am missing something but I just do not get it. > > > > > > I believe you started to implement the mcp2518fd. > > No I've just looked into the register description. OK. For your information, the ETAS ES58x FD devices do not allow the use of manual mode for TDCV. The microcontroller from Microchip supports it but ETAS firmware only exposes the automatic TDCV mode. So it can not be used to test what would occur if SSP = 0. I will prepare a patch to allow zero value for both TDCV and TDCO (I am a bit sad because I prefer the current design, but if ISO allows it, I feel like I have no choice). However, I refuse to allow the negative TDCO value unless someone is able to explain the rationale. Yours sincerely, Vincent