<div dir="ltr">I'm pretty sure. I got this <span style="font-family:arial,sans-serif;font-size:13px">calculation</span> from Xavier, he made the first version of the Canion app. A Android app to <span style="color:rgb(51,51,51);font-family:Roboto,Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(245,245,245)">visualize data from the can-bus on i-Miev, iOn and C-Zero. </span><a href="https://play.google.com/store/apps/details?id=emobility.canion&hl=no">https://play.google.com/store/apps/details?id=emobility.canion&hl=no</a><div>
<br></div><div>The <span style="font-family:arial,sans-serif;font-size:13px">calculation</span> also seams to be correct when i logged the can bus during charging yesterday, I had 14 bars and SOC was 85% with this <span style="font-family:arial,sans-serif;font-size:13px">calculation</span>.</div>
<div><br></div><div>Regards, Thomas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/19 Håkon Markussen <span dir="ltr"><<a href="mailto:hakon.markussen@gmail.com" target="_blank">hakon.markussen@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>@Thomas:<br></div>Are you sure this calculation is correct for iMiEV?<br><i>car_SOC = (char)(((int)can_databuffer[1] - 10) / 2);<br>
</i></div><br>This means byte 1 can be:<br>Ah (d10) = 0% SOC  (minimum)<br>
</div>6Eh (d110) = 50% SOC<br></div>D2h (d210) = 100% SOC (maximum)<br><br></div>Br.<br>Håkon<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/19 Thomas Bergo <span dir="ltr"><<a href="mailto:thomas.bergo@gmail.com" target="_blank">thomas.bergo@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Thank you for your attention.<div><br></div><div>This is the same information that i have:</div><div>
<br></div><div>SOC shuld be 0x374, byte 1. This I have confirmed using my laptop and the CAN-Do SW.</div>
<div><br></div><div>
I used the Think code as a template for setting up the filter and poll interupts. So I belived that it shuld be a straight forward task to read the messages.</div><div><br></div><div>I will post my filter setup and poll1 code later,  I belive that you will see what's wrong<span></span>. </div>


<div><br></div><div>Regards, Thomas<br><br>torsdag 19. september 2013 skrev Nikolay Shishkov  følgende:<div><div><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif">
<div><span>Hi Thomas,</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


<span>Here is some info on the messages that you can see on the Miev CAN bus.</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


0x210 - accelerator pedal</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="background-color:transparent">0x298 - trip meter</span><br>


</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">0x346 - range</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


0x373 - amps, volts</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">0x374 - SOC</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


0x389 - Amp, Volts</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">0x412 -
 speed, odometer</div><div style="background-color:transparent">0x418 - shifter position</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


0x424 - switches and stuff - like lights, etc.</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">0x6E1, 0x6E2, <span style="font-size:12pt">0x6E3, 0x6E4 - cell voltages, and temps</span></div>


<div style="font-style:normal;font-size:12pt;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt"><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


<span style="font-size:12pt">Once you get familiar with the ovms, maybe you can find it easier to use the Twizy or the Think code, instead of starting from scratch.</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif">


<span style="font-size:12pt"><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt">Hope this helps,</span></div>


<div style="font-style:normal;font-size:12pt;background-color:transparent;font-family:'times new roman','new york',times,serif"><span style="font-size:12pt">Nikolay</span></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"> <hr size="1">  <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> Thomas Bergo <<a>thomas.bergo@gmail.com</a>><br>


 <b><span style="font-weight:bold">To:</span></b> OVMS Developers <<a>ovmsdev@lists.teslaclub.hk</a>> <br> <b><span style="font-weight:bold">Sent:</span></b> Thursday, September 19, 2013 9:01 AM<br>
 <b><span style="font-weight:bold">Subject:</span></b> Re: [Ovmsdev] i-Miev/C-Zero/iOn<br> </font> </div> <div><br>
<div>Yesterday I managed to verify that both poll0 and poll1 interrupt is called.<div><br></div><div>Printed "car_idealrange =id;" from poll0 to see the PID's that triggered the interrupt. Only get id 768 (0x300) printed out.</div>



<div><br></div><div>Also tried to do a the printout fom inside case 0x374: but no updates. The strange ting is that I can see a lot of "374" messages, and none "300" when using my laptop.</div><div><br>



</div><div>Start wonder if the PID "374" that I find on my laptop is not a hex value? Any one here that has any experiance with CAN-Do SW for analysing <span></span>CAN mesages? </div><div><br></div><div>Will do some more testing later.</div>



<div><br></div><div>Regards, Thomas<br><br>onsdag 18. september 2013 skrev Mark Webb-Johnson  følgende:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">



<div><br></div><blockquote type="cite"><div dir="ltr">Is there a simple way to print out a value to the DIAG port for debugging?</div></blockquote><div><div dir="ltr"><br></div></div><div dir="ltr">You can just net_puts it, normally prefixed with a "#" sign as  a comment. Have a look in diag.c for lots of examples. You will need to type 'ATE1' when going into diag mode, to get the echo output. The way it works is that you send the command to the modem (net_puts()), which discards it as unrecognised, but echos it back to the terminal.</div>



<div dir="ltr"><br></div><div dir="ltr">But, you can't do that in interrupt handlers - only in normal ticker(), or message handler, style code</div><div dir="ltr"><br></div><div dir="ltr">Regards, Mark.</div><div dir="ltr">



<br></div><div><div>On 18 Sep, 2013, at 8:22 PM, Thomas Bergo <<a rel="nofollow">thomas.bergo@gmail.com</a>> wrote:</div><br><blockquote type="cite">
<div dir="ltr">Thank you for your help.<div><br></div><div>Fixed some typos and now ODO updates in "STAT?" ODO is still wrong, but at least i get updates. No luck with SOC so far.</div><div><br></div><div>Have verified that the PID and the data is correct by using a CAN interface on my laptop. </div>




<div><br></div><div>Will do some more debugging to verify that both poll0 and poll1 is called.</div><div><br></div><div>Is there a simple way to print out a value to the DIAG port for debugging?</div><div><br></div><div>



Regards, Thomas</div>
</div><div><br><br><div>2013/9/17 Mark Webb-Johnson <span dir="ltr"><<a rel="nofollow">mark@webb-johnson.net</a>></span><br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div>Thanks, Håkon - nice clear answer.<div><br></div><div>One other suggestion is that you can put "car_idealrange++; return TRUE;" and "car_estrange++; return TRUE;" in the poll0 and poll1 functions, near the top. A few STAT commands and you can see if the poll functions are actually being called. You can also put "car_idealrange=id; return TRUE;", etc, to get an idea of what IDs are being delivered. It is very nasty trying to debug interrupt handlers, but this approach can help.</div>




<div><br></div><div>The diag port mentioned is shown here:</div><div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><a rel="nofollow" href="http://www.youtube.com/watch?v=-24PoWtHVzk" target="_blank">OVMS Setup Diagnostics Mode</a></div>




</blockquote></div><div><br></div><div>Regards, Mark.</div><div><div><br><div><div>On 16 Sep, 2013, at 4:55 PM, Håkon Markussen <<a rel="nofollow">hakon.markussen@gmail.com</a>> wrote:</div>

<br><blockquote type="cite"><div dir="ltr"><div><div><div><div><div><div><div>Hi Thomas,<br><br><i>"Still has some debugging to do on the i-Miev code, as i'm only get "SOC: 0%" from STAT?"<br></i></div>




<br>Are you able to read any CAN-bus values from your iMiEV?<br>
<br></div>I experienced once at my Think City, that the Ovms-module did not read the CAN-bus at all; I got 0% SOC.<br>The problem was I had two external CAN-devices connected at the same time (Duinomite Mega + OVMS). It worked fine when both modules were powered on at the same time, but Ovms failed to read the bus when the Duinomite Mega was powered off.<br>





<br></div>Du you have access to any kind of can-reader tool? This can be used to verify that you are looking at the correct bytes.<br></div>I've used P-CAN USB adapter<br><a href="http://www.peak-system.com/PCAN-USB.199.0.html?&L=1" target="_blank">http://www.peak-system.com/PCAN-USB.199.0.html?&L=1</a><br>





and PCANView <br><a href="http://www.computer-solutions.co.uk/gendev/can-basic-dll.htm" target="_blank">http://www.computer-solutions.co.uk/gendev/can-basic-dll.htm</a><br><br></div>You can use it to verify you have SOC in msg 0x374 byte 1.<br>





<br></div><div>To understand the mask and filter, you have to consider the mask as a bit "enable" / "disable". Any zero in the mask bit disables that</div></div></div></blockquote></div></div></div></div>


</blockquote></div></div></blockquote></div></div></blockquote></div></div></div></div> </div>  </div></div></blockquote></div></div></div>
<br></div></div><div class="im">_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>