<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Nikolay,</div><div><br></div><div>I suggest you look at the Volt/Ampera module first. That is the simplest and just handles three CAN messages - SOC, vin#1 and vin#2. Your Think probably has an equivalent three. You should be able to just change the CAN IDs, and information extraction.</div><div><br></div><div>You can see the global variables are used, then use a global STAT SMS to test (DIAG mode is the easiest and fastest way to test this stuff).</div><div><br></div><div>Regards, Mark</div><div><br>On 3 Jan, 2013, at 7:23 AM, Michael Balzer <<a href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
Nikolay,<br>
<br>
you normally only need "volatile" if there are concurrent reads
& writes from tasks and/or interrupts to variables. All reads
and writes up to word size (= 2 byte = int) can be considered atomic
on the PIC18, and can_soc will only be written to by the IRQ and
read from by the high level functions, so you normally won't need
"volatile" on the can_soc variable alone.<br>
<br>
New guess: you said you're using filter #2 for 0x30* msg ids, and
changed my can_soc reader -- now, my can_soc reader happens to be
located in poll0(), which is assigned to buffer #0 = filters #0
& #1. For filter #2 you'd need to use buffer #1 and accordingly
poll1(). Did you change the code accordingly for that setup?<br>
<br>
"Internal" means "in the OVMS module". If your car does not provide
GPS, you can use the OVMS GPS by enabling both the compiler switch
"OVMS_INTERNALGPS" and the net_fnbits (exactly as the twizy module
does). You'll also need an active GPS antenna, a simple one will do
perfectly, but take care it will run on 3 V (some older/special ones
only run on 5 V). Also be aware that the internal GPS will raise the
OVMS current needs to about 110 mA = about 34 Wh/day or 1 kWh/month
-- should be no problem with frequent car use & charging though.<br>
<br>
SMS commands and replies do not go through the OVMS server but are
exchanged directly between mobile phone and OVMS module. The server
is solely responsible for the IP connectivity (MSG commands).
Primary tool for debugging is the DIAG port and mode, please read
"docs/Firmware-Development.odt" for instructions on how to use that.<br>
<br>
The currently available Android App does not yet support arbitrary
MSG commands (I think the iOS one does, but can't test that). If you
want to send your own MSG commands to your live module, you can also
use the perl client for that:
<a class="moz-txt-link-freetext" href="https://github.com/markwj/Open-Vehicle-Monitoring-System/blob/master/server/client_app.pl">https://github.com/markwj/Open-Vehicle-Monitoring-System/blob/master/server/client_app.pl</a><br>
<br>
You need to change the passwords (line 11+12) and the car id (line
41 "TESTCAR") in the .pl file. Then you can send a command like
this, for example before entering the receive loop:<br>
<br>
my $encrypted = encode_base64($txcipher->RC4("MP-0
C32,RT-GPS-Log"),'');<br>
print STDERR " Sending message $encrypted\n";<br>
print $sock "$encrypted\r\n";<br>
<br>
This for example will send command 32 (C32 = retrieve historical
data) to the module with argument "RT-GPS-Log". The result will be
printed on stdout by the receive loop.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 02.01.2013 20:48, schrieb Nikolay
Shishkov:<br>
</div>
<blockquote cite="mid:1357156121.54356.YahooMailNeo@web142604.mail.bf1.yahoo.com" type="cite">
<div style="color:#000; background-color:#fff; font-family:times
new roman, new york, times, serif;font-size:12pt">
<div>Michael, </div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">I have had some conflicting
experiences with CAN bus, and have learned the lesson to test
where the values are and take it from there. This is why I
actually used the car_linevoltage and car_charging current
variables and put the can_buffer bytes 0,1,2,3 in them to see
what am I getting... and the result was zeros. While the 4 and
5 are getting the old value.</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">It almost seems like the CAN
bus registers are not written when I am reading them. And the
can_2_soc2 variable is just getting its value from the same
memory location as last time... although it should have been
initialized. </div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">Do the can_soc variable need
to be declared as "volatile"?</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">What is "internal" GPS? Is
it internal to the car? Or internal to the OVMS module? What
should be the setting if there is no GPS coordinates reported
on the CAN bus?</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">Can I see my debug commands
(like when I send DEBUG SMS) from the <a href="http://openvehicle.com">openvehicle.com</a> server?
Or I need the android app for that?</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;">Thanks,</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><span style="background-color: transparent;">Nikolay</span><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color:
transparent; font-style: normal;"><br>
</div>
<div><br>
</div>
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt;">
<div style="font-family: 'times new roman', 'new york', times,
serif; font-size: 12pt;">
<div dir="ltr"> <font face="Arial" size="2">
<hr size="1"> <b><span style="font-weight:bold;">From:</span></b>
Michael Balzer <a class="moz-txt-link-rfc2396E" href="mailto:dexter@expeedo.de"><dexter@expeedo.de></a><br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a> <br>
<b><span style="font-weight: bold;">Sent:</span></b>
Wednesday, January 2, 2013 8:34 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b>
Re: [Ovmsdev] some partial success<br>
</font> </div>
<br>
<meta http-equiv="x-dns-prefetch-control" content="off">
<div id="yiv564144648">
<div> Nikolay, Mark,<br>
<br>
Am 02.01.2013 19:28, schrieb Nikolay Shishkov:<br>
<blockquote type="cite">
<div style="color: rgb(0, 0, 0); background-color:
rgb(255, 255, 255); font-family: 'times new roman',
'new york', times, serif; font-size: 12pt;"><br>
<div style="background-color: transparent; color:
rgb(0, 0, 0); font-size: 16px; font-family: 'times
new roman', 'new york', times, serif; font-style:
normal;">
<div style="color:rgb(0, 0, 0);font-family:'times
new roman', 'new york', times,
serif;font-size:16px;font-style:normal;">
can_2_soc2 = ((unsigned int)
can_databuffer[4] << 8) +
can_databuffer[5];</div>
<div style="color:rgb(0, 0, 0);font-family:'times
new roman', 'new york', times,
serif;font-size:16px;font-style:normal;">Initially
I got the 5th and 6th array elements, but
noticed that I had it wrong... so I changed to
4th and 5th... </div>
<div style="color:rgb(0, 0, 0);font-family:'times
new roman', 'new york', times,
serif;font-size:12pt;font-style:normal;"><br>
</div>
<div style="color:rgb(0, 0, 0);font-family:'times
new roman', 'new york', times,
serif;font-size:12pt;font-style:normal;">And
finally at the debug sms handler:</div>
<div>
<div> s = stp_i ( s, " SOC=", can_2_soc2
);</div>
<div style="color:rgb(0, 0,
0);font-family:'times new roman', 'new york',
times,
serif;font-size:12pt;font-style:normal;"><br>
</div>
<div style="color:rgb(0, 0,
0);font-family:'times new roman', 'new york',
times,
serif;font-size:12pt;font-style:normal;">I
changed the strings abit and can see that the
new code is running, but do not understand how
come a completely different values are
reported - the value is from can_databuffer[5]
and can_databuffer[6].</div>
<div style="color:rgb(0, 0,
0);font-family:'times new roman', 'new york',
times,
serif;font-size:12pt;font-style:normal;">So
the 301 contains the following bytes (viewed
with PCAN) 00 00 0e 7d 01 b2 0a 4a. </div>
<div style="color:rgb(0, 0,
0);font-family:'times new roman', 'new york',
times,
serif;font-size:12pt;font-style:normal;"><span style="font-size:12pt;background-color:transparent;">The SOC is supposed
to be in 0E7D (actually it is the DOD), but
I am getting the 0AB2 in the can_2_soc2
value.</span><br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
I don't know PCAN, but the CAN byte numbering normally
begins at 0 on the left, so 0e in your example is
can_databuffer[2] and 7d is ...[3].<br>
<br>
If you get 0AB2, that would be [6][5] = your initial
code?<br>
<br>
Btw: we could solve variable name conflicts between
vehicle modules by introducing some namespace prefix
(replacing "can_") like Mark already did for the
functions. I'd shorten that for vars to e.g. "vrt_" for
"vehicle renault twizy", accordingly "vtc_" for the
Think and so on. OK, Mark?<br>
<br>
Regards,<br>
Michael<br>
<br>
<pre class="yiv564144648moz-signature">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</div>
</div>
<meta http-equiv="x-dns-prefetch-control" content="on">
<br>
_______________________________________________<br>
OvmsDev mailing list<br>
<a moz-do-not-send="true" ymailto="mailto:OvmsDev@lists.teslaclub.hk" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a moz-do-not-send="true" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br>
<br>
</div>
</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">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="72">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</div></blockquote><blockquote type="cite"><div><dexter.vcf></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>OvmsDev mailing list</span><br><span><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a></span><br><span><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br></div></blockquote></body></html>