<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
OK, first implementation is done & pushed. Documentation is
missing, I'll add that ASAP.<br>
<br>
Basic usage:<br>
<br>
<tt>OVMS > can ?</tt><tt><br>
</tt><tt>can1 CANx framework</tt><tt><br>
</tt><tt>can2 CANx framework</tt><tt><br>
</tt><tt>can3 CANx framework</tt><tt><br>
</tt><tt>log CAN logging framework</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log ?</tt><tt><br>
</tt><tt>crtd ...format logging</tt><tt><br>
</tt><tt>off Stop logging</tt><tt><br>
</tt><tt>status Logging status</tt><tt><br>
</tt><tt>trace Logging to syslog</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log status </tt><tt><br>
</tt><tt>CAN logging inactive.</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log trace ?</tt><tt><br>
</tt><tt>Usage: can log trace [filter1] [filter2] [filter3]</tt><tt><br>
</tt><tt>Filter: <bus> / <id>[-<id>] /
<bus>:<id>[-<id>]</tt><tt><br>
</tt><tt>Example: 2:2a0-37f</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log crtd ?</tt><tt><br>
</tt><tt>Usage: can log crtd <path> [filter1] [filter2]
[filter3]</tt><tt><br>
</tt><tt>Filter: <bus> / <id>[-<id>] /
<bus>:<id>[-<id>]</tt><tt><br>
</tt><tt>Example: 2:2a0-37f</tt><tt><br>
</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log trace </tt><tt><br>
</tt><tt>CAN logging active: Type:trace; Path:''; Filter:off;
Vehicle:;</tt><tt><br>
</tt><tt>Note: info logging is done at log level debug, frame
logging at verbose</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can can2 tx standard 201 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>E (358776) canlog: Error can2 rxpkt=0 txpkt=1
errflags=0x8000 rxerr=63 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log off </tt><tt><br>
</tt><tt>Closing log: Type:trace; Path:''; Filter:off; Vehicle:;</tt><tt><br>
</tt><tt>CAN logging stopped.</tt><tt><br>
</tt><tt><br>
</tt><tt><br>
</tt><tt>OVMS > can log crtd /sd/test.crtd 1 2:780-7ff</tt><tt><br>
</tt><tt>CAN logging active: Type:crtd; Path:'/sd/test.crtd';
Filter:1:0-ffffffff,2:780-7ff; Vehicle:;</tt><tt><br>
</tt><tt>OVMS > can can1 rx standard 100 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can can1 tx standard 101 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can can2 rx standard 200 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can can2 tx standard 201 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can can2 rx standard 7d2 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can can2 tx standard 7d3 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>OVMS > can log off </tt><tt><br>
</tt><tt>Closing log: Type:crtd; Path:'/sd/test.crtd';
Filter:1:0-ffffffff,2:780-7ff; Vehicle:;</tt><tt><br>
</tt><tt>CAN logging stopped.</tt><tt><br>
</tt><tt><br>
OVMS > vfs cat /sd/test.crtd</tt><tt><br>
</tt><tt>459.576 CXX Info Type:crtd; Path:'/sd/test.crtd';
Filter:1:0-ffffffff,2:780-7ff; Vehicle:;</tt><tt><br>
</tt><tt>476.706 1R11 100 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>480.366 1T11 101 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=28 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=28 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=37 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=46 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=55 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=64 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=73 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8000a6
rxerr=82 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x44000
rxerr=99 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x44000
rxerr=99 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8040a6
rxerr=100 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8040a6
rxerr=109 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8040a6
rxerr=118 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8040a6
rxerr=127 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x204000
rxerr=135 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>480.366 1CEV Error rxpkt=1 txpkt=1 errflags=0x8040a6
rxerr=135 txerr=0 rxovr=0 txovr=0 txdelay=0</tt><tt><br>
</tt><tt>522.616 2R11 7D2 12 34 56 11 22 33 44 55</tt><tt><br>
</tt><tt>522.616 2CEV TX_Queue T11 7D3 12 34 56 11 22 33 44 55</tt><br>
<br>
<br>
Vehicle events are also logged, and if you issue "can <bus>
status", the packet statistics will be logged.<br>
<br>
The crtd logger is fast enough for the (single bus) Twizy at 500
kbit without filters. I still have no means to test multiple buses.<br>
<br>
The current implementation limits the user to one active can logger,
but that's just for ease of use and not fixed. We can add support
for multiple parallel loggers, but I doubt there's an actual use
case for this.<br>
<br>
Btw, as a next logger, we could implement the pcapng format:
<a class="moz-txt-link-freetext" href="https://wiki.wireshark.org/Development/PcapNg">https://wiki.wireshark.org/Development/PcapNg</a><br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 14.01.2018 um 18:13 schrieb Michael
Balzer:<br>
</div>
<blockquote type="cite"
cite="mid:fde432cc-6489-1d73-44e3-5a3b840c332c@expeedo.de">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Mark,<br>
<br>
thanks for the info, I'll add a documentation file on this.<br>
<br>
It just turned out writing into a file is far too slow to be done
inline with the frame processing… and yes, I _could_ have
anticipated that ;)<br>
<br>
Maybe idf 3.x will perform better on file I/O, but a separate
logging task is better anyway.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 12.01.2018 um 01:44 schrieb Mark
Webb-Johnson:<br>
</div>
<blockquote type="cite"
cite="mid:04E65A88-EB04-4159-A302-F39EB4DF7DE9@webb-johnson.net">
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
Thanks.
<div class=""><br class="">
</div>
<div class="">I really should formally document the CRTD format
properly somewhere. Anyway, here are my old notes on it, and
an example:
<div class=""><br class="">
</div>
<div class="">+++++</div>
<div class=""><br class="">
</div>
<div class="">CRTD Example:</div>
<div class=""><br class="">
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding:
0px;" class="">
<div class=""><font class="" face="Andale Mono"><span
style="font-size: 14px;" class="">1320724293.000 CXX
OVMS Tesla Roadster cando2crtd converted log</span></font></div>
<div class=""><font class="" face="Andale Mono"><span
style="font-size: 14px;" class="">1320724293.000 CXX
OVMS Tesla roadster log: trip.20111108.csv</span></font></div>
<div class=""><font class="" face="Andale Mono"><span
style="font-size: 14px;" class="">1320724294.072 R11
420 00 96 96<br class="">
1320724294.073 R11 588 00 00 86<br class="">
1320724294.073 R11 280 00 00 03 00 00 00 00 00<br
class="">
1320724294.073 R11 001 00 00 00 00<br class="">
1320724294.073 R11 590 01 00 00 00 00 00 00 00<br
class="">
1320724294.113 R11 400 01 01 00 00 00 00 4C 1D</span></font></div>
</blockquote>
<div class="">
<div><br class="">
</div>
<div>Generators should use whatever line termination the
host system uses. For Unix and embedded systems that is
LF. Parsers should support all CR, LF, and CRLF variants.</div>
<div><br class="">
</div>
<div>Generators should output hex fields in upper-case and
front zero padded (for clarity). Parsers should support
both upper and lower case, as well as variable length.</div>
<div><br class="">
</div>
<div>By convention, the .crtd extension is used for these
files. It is suggested that generators prefix all crtd
files with CXX lines documenting the generator, comment
and source of log file.</div>
<div><br class="">
</div>
<div>Space-separated fields are:</div>
<div>
<ul class="MailOutline">
<li class="">Timestamp (can be seconds, milliseconds, or
microseconds - zero prefixed and full length padded
for ms and us).</li>
<li class="">Type:</li>
<ul class="">
<li class="">C*: comment</li>
<ul class="">
<li class="">CXX: general comment (rest of line is a
comment)</li>
<li class="">CEV: user-generated event (rest of line
is event description)</li>
</ul>
<li class="">R11: rx standard frame</li>
<li class="">R29: rx extended frame</li>
<li class="">T11: tx standard frame</li>
<li class="">T29: tx extended frame</li>
</ul>
</ul>
<div class=""><br class="">
</div>
<div class="">Other field notes:</div>
<ul class="MailOutline">
<li class="">For the R?? and T?? types, the rest of the
line is hex ID followed by hex data bytes (up to 8).<br
class="">
</li>
<li class="">In the case of systems supporting multiple
CAN buses, the type can be prefixed with the bus
number (eg; 1R11, 2T29, etc). Messages from different
CAN bus captures can be written to one shared crtd
file, or individual files for each bus - entirely up
to the generator.</li>
</ul>
</div>
<div><br class="">
</div>
<div>+++++</div>
<div><br class="">
</div>
<div>Regards, Mark.</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 11 Jan 2018, at 8:59 PM, Michael Balzer
<<a href="mailto:dexter@expeedo.de" class=""
moz-do-not-send="true">dexter@expeedo.de</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<div class="moz-cite-prefix">Mark,<br class="">
<br class="">
I'll add the logging support along with the TX
queue.<br class="">
<br class="">
Regards,<br class="">
Michael<br class="">
<br class="">
<br class="">
Am 10.01.2018 um 01:27 schrieb Mark Webb-Johnson:<br
class="">
</div>
<blockquote type="cite"
cite="mid:D4A07E68-FD57-4A6E-AEDC-FD4FBE97E547@webb-johnson.net"
class="">
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" class="">
Probably best to split this off as a separate
eMail thread.
<div class=""><br class="">
</div>
<div class="">I think the implementation would be
relatively simple.</div>
<div class=""><br class="">
</div>
<div class="">
<ul class="MailOutline">
<li class="">Create a canlog class with a
FILE* m_log member variable, and a virtual
function Log() that is called with a
direction (tx/rx) and frame to log.</li>
<ul class="">
<li class="">The constructor should be
passed the vfs file path to log to. It
should fopen the m_log file to that.</li>
<li class="">The destructor should fclose
the m_log file.</li>
</ul>
<li class="">Create a canlog_crtd class,
derived from canlog, that supports Log() to
log to m_log in CRTD format.</li>
<li class="">Optionally create other canlog_*
classes, for other logging formats that we
want to support.</li>
<li class="">Add a canlog* m_log member
variable in canbus.</li>
<ul class="">
<li class="">Initialise m_log to NULL in the
constructor.</li>
<li class="">In the destructor, if m_log is
not null, delete it’s object and set it to
NULL.</li>
<li class="">Have a command ‘can log’ like
‘can trace’ that specifies a vfs file path
(remember to check it with
OvmsConfig ProtectedPath) and logging
format. It will then ’new’ a canlog_*
style object (depending on logging
format).</li>
</ul>
<li class="">In can::IncomingFrame, log
incoming CAN messages with m_log->Log(),
in the same way as m_trace is handled.</li>
<li class="">In canbus::Write, log outgoing
CAN messages with m_log->Log(), in the
same way as m_trace is handled.</li>
</ul>
<div class=""><br class="">
</div>
<div class="">Volunteer?</div>
<div class=""><br class="">
</div>
<div class="">Regards, Mark.</div>
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 10 Jan 2018, at 8:07 AM,
Mark Webb-Johnson <<a
href="mailto:mark@webb-johnson.net"
class="" moz-do-not-send="true">mark@webb-johnson.net</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="font-family:
Helvetica; font-size: 24px; font-style:
normal; font-variant-caps: normal;
font-weight: normal; letter-spacing:
normal; text-align: start; text-indent:
0px; text-transform: none; white-space:
normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float:
none; display: inline !important;"
class="">Now SD CARD support is coming,
anybody want to step forward and extend
components/can to support CAN bus
logging to a file (in crtd format, or
perhaps support one or two popular
formats)? Implementation would be in
class canbus, very similar to m_trace;
just need to have a FILE* m_log and
appropriate commands / logging of packet
write/read in the same place that trace
does it.</span></div>
</blockquote>
</div>
<br class="">
</div>
<br class="">
<fieldset class="mimeAttachmentHeader"></fieldset>
<br class="">
<pre class="" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk" moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br class="">
<br class="">
<pre class="moz-signature" cols="144">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
</div>
_______________________________________________<br
class="">
OvmsDev mailing list<br class="">
<a href="mailto:OvmsDev@lists.teslaclub.hk" class=""
moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
class="">
<a class="moz-txt-link-freetext"
href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk" moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="160">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="160">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
</body>
</html>