Diagnostics

Start, stop and download triggers. More...

Functions

canStatus kvDiagConfigure (const CanHandle hnd, const char *configBuffer, DiagDataPtr diagData)
 
canStatus kvDiagStart (const CanHandle hnd)
 
canStatus kvDiagStop (const CanHandle hnd)
 
canStatus kvDiagReadSampleRaw (DiagDataPtr diagData, uint8_t *buffer, uint32_t bufferLength, int *sampleLength)
 
canStatus kvDiagGetNumberOfAnalyzers (const CanHandle hnd, uint8_t *analyzerCount)
 
canStatus kvDiagGetAnalyzerInfo (const CanHandle hnd, uint8_t analyzerNo, uint32_t *type, uint32_t *version)
 

Detailed Description

Start, stop and download triggers.

Function Documentation

◆ kvDiagConfigure()

canStatus kvDiagConfigure ( const CanHandle  hnd,
const char *  configBuffer,
DiagDataPtr  diagData 
)

Download a trigger to an attached analyzer and connect it to a diagnostic data buffer. There are two types of triggers:

1. Autobaud trigger. This trigger is used to calculate bitrate.

const char *TRIGGER_AUTOBAUD = "trigger=autobaud\n";

2. Normal trigger. This trigger is used when the bitrate is known, e.g.:

const char *TRIGGER_1MBIT = "trigger=normal\n"
"tseg1=59\n"
"tseg2=20\n"
"sjw=16\n"
"brp=1\n"
"nbsample=-1\n";

where

tseg1 Time segment 1, that is, the number of quanta from (but not
including) the Sync Segment to the sampling point.
tseg2 Time segment 2, that is, the number of quanta from the sampling
point to the end of the bit.
sjw The Synchronization Jump Width.
brp Bitrate prescaler.
nbsample Number of samples before trigger stops or use -1 to never stop.
Note
The kvDiag API is preliminary and will change!
Parameters
[in]hndAn open handle to a CAN channel with an attached analyzer.
[in]configBufferA null terminated buffer containing a trigger configuration, see TRIGGER_AUTOBAUD and TRIGGER_1MBIT.
[in]diagDataA diagnostic data buffer allocated with kvDiagAlloc().
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagAlloc(), kvDiagAttach()

◆ kvDiagGetAnalyzerInfo()

canStatus kvDiagGetAnalyzerInfo ( const CanHandle  hnd,
uint8_t  analyzerNo,
uint32_t *  type,
uint32_t *  version 
)

Get the number of analyzers.

Note
The kvDiag API is preliminary and will change!
Parameters
[in]hndAn open handle to a CAN channel.
[in]analyzerNoThe numbering is zero based.
[out]typeThe analyzer type.
[out]versionThe analyzer version.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagGetNumberOfAnalyzers()

◆ kvDiagGetNumberOfAnalyzers()

canStatus kvDiagGetNumberOfAnalyzers ( const CanHandle  hnd,
uint8_t *  analyzerCount 
)

Get the number of analyzers.

Note
The kvDiag API is preliminary and will change!
Parameters
[in]hndAn open handle to a CAN channel.
[out]analyzerCountNumber of analyzers.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagGetAnalyzerInfo()

◆ kvDiagReadSampleRaw()

canStatus kvDiagReadSampleRaw ( DiagDataPtr  diagData,
uint8_t *  buffer,
uint32_t  bufferLength,
int *  sampleLength 
)

Read (and consume) one full sample from an analyzer. The sample is written to a buffer, and sampleLength is updated with the length of the sample.

Note
The kvDiag API is preliminary and will change!
Parameters
[in]diagDataPointer to a DiagDataPtr.
[out]bufferPointer to buffer to receive the sample.
[in]bufferLengthThe length of the buffer.
[out]sampleLengthThe length of read sample.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagAlloc(), kvDiagConfigure(), kvDiagStart()

◆ kvDiagStart()

canStatus kvDiagStart ( const CanHandle  hnd)

Start data acquisition.

Note
The kvDiag API is preliminary and will change!
Parameters
[in]hndAn open handle to a CAN channel with an attached analyzer.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagConfigure() kvDiagStop()

◆ kvDiagStop()

canStatus kvDiagStop ( const CanHandle  hnd)

Stop data acquisition.

Note
The kvDiag API is preliminary and will change!
Parameters
[in]hndAn open handle to a CAN channel with an attached analyzer.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvDiagStart()