<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Other option I tried is to power from USB. But maybe not so easy in a Twizy?</div><div><br></div><div>I should have new chips early next week. Arranging now.</div><div><br></div><div>Regards, Mark</div><div><br>On 17 May 2018, at 5:48 PM, Michael Balzer <<a href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Wow. Confirmed, speedup is at least factor 5.<br>
<br>
And better yet, the fsync() overhead is reduced from ~50 ms to <
10 ms as well, the performance impact of SD logging is now fully
acceptable for every day use.<br>
<br>
All of my beta testers use SD cards to provide debug logs. Some also
have been doing CAN logging, which helped debug some timing issues.<br>
<br>
I'll need another 3.1 module anyway, but the testers will most
likely want to continue using their modules. I'll forward your
rework offer and the info on how to solve this themselves if they're
capable of doing micro-soldering.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 17.05.2018 um 10:40 schrieb Mark
Webb-Johnson:<br>
</div>
<blockquote type="cite" cite="mid:C33A2DBF-2A19-4423-B3CC-D38F3534A1FA@webb-johnson.net">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div class=""><br class="">
</div>
It is a lot faster when working correctly. To me, it seems much
more than 25%. Maybe four or five times faster?
<div class=""><br class="">
</div>
<div class="">You can try:</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding:
0px;" class="">
<div class="">config set sdcard maxfreq.khz 20000</div>
</blockquote>
<div class="">
<div>then reboot and power from USB. Then try your speed test.
Perhaps vfs cp from SD to SD to test?</div>
<div><br class="">
</div>
<div>Regards, Mark.</div>
<div><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On 17 May 2018, at 4:15 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=""> Thanks for
the analysis and solution!<br class="">
<br class="">
What kind of speedup is achievable by replacing the
cp2102? Is it just linear 16 → 20 MHz = 25%?<br class="">
<br class="">
Or does this also solve hidden retransmission issues?<br class="">
<br class="">
<br class="">
<tt class=""><a class="moz-txt-link-abbreviated" href="mailto:balzer@leela:%7E/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3" moz-do-not-send="true">balzer@leela:~/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3</a>>
time ssh dexze85.local "vfs ls /sd/logs"</tt><tt class=""><br class="">
</tt><tt class=""> 541.7k 22-Apr-2018 22:34
can-180422</tt><tt class=""><br class="">
</tt><tt class=""> 449.0k 17-May-2018 09:56 log</tt><tt class=""><br class="">
</tt><tt class=""> 580.8k 01-May-2018 18:15 dm</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 30-Apr-2018 00:51
log.20180430-005121</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 30-Apr-2018 10:27
log.20180430-102732</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 30-Apr-2018 19:41
log.20180430-194146</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 01-May-2018 02:21
log.20180501-022128</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 01-May-2018 11:03
log.20180501-110318</tt><tt class=""><br class="">
</tt><tt class=""> 80 01-May-2018 14:09
can-180501</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 01-May-2018 17:56
log.20180501-175658</tt><tt class=""><br class="">
</tt><tt class=""> 1.1M 01-May-2018 18:17 dm2</tt><tt class=""><br class="">
</tt><tt class=""> 2.0M 01-May-2018 18:28 dm3</tt><tt class=""><br class="">
</tt><tt class=""> 1.3M 01-May-2018 20:21 dm4</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 02-May-2018 04:06
log.20180502-040605</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 02-May-2018 13:38
log.20180502-133816</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 03-May-2018 00:04
log.20180503-000415</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 03-May-2018 10:38
log.20180503-103815</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 03-May-2018 19:46
log.20180503-194654</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 04-May-2018 06:22
log.20180504-062242</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 04-May-2018 17:23
log.20180504-172311</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 05-May-2018 03:50
log.20180505-035002</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 05-May-2018 15:01
log.20180505-150115</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 06-May-2018 01:22
log.20180506-012241</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 06-May-2018 09:42
log.20180506-094249</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 06-May-2018 16:58
log.20180506-165842</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 02:08
log.20180507-020820</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 09:08
log.20180507-090846</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 13:10
log.20180507-131042</tt><tt class=""><br class="">
</tt><tt class=""> 630.2k 23-Apr-2018 23:51
can-180423</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 16:40
log.20180507-164032</tt><tt class=""><br class="">
</tt><tt class=""> 3.6M 24-Apr-2018 00:30
can-180424</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 24-Apr-2018 01:09
log.20180424-010932</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 24-Apr-2018 11:36
log.20180424-113642</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 24-Apr-2018 18:41
log.20180424-184124</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 25-Apr-2018 02:54
log.20180425-025415</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 25-Apr-2018 13:10
log.20180425-131000</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 25-Apr-2018 23:40
log.20180425-234048</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 26-Apr-2018 08:23
log.20180426-082309</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 26-Apr-2018 13:17
log.20180426-131718</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 26-Apr-2018 17:32
log.20180426-173218</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 26-Apr-2018 22:26
log.20180426-222645</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 27-Apr-2018 06:19
log.20180427-061932</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 27-Apr-2018 11:45
log.20180427-114534</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 27-Apr-2018 16:07
log.20180427-160751</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 28-Apr-2018 05:07
log.20180428-050703</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 28-Apr-2018 14:39
log.20180428-143956</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 29-Apr-2018 00:07
log.20180429-000755</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 29-Apr-2018 10:26
log.20180429-102600</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 29-Apr-2018 14:09
log.20180429-140942</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 18:39
log.20180507-183951</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 07-May-2018 21:18
log.20180507-211821</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 01:06
log.20180508-010616</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 08:12
log.20180508-081232</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 13:31
log.20180508-133133</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 14:52
log.20180508-145232</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 15:55
log.20180508-155530</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 16:18
log.20180508-161814</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 16:33
log.20180508-163344</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 16:51
log.20180508-165156</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 08-May-2018 18:40
log.20180508-184035</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 02:13
log.20180509-021338</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 11:28
log.20180509-112803</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 13:10
log.20180509-131042</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 13:30
log.20180509-133049</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 13:46
log.20180509-134607</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 14:02
log.20180509-140208</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 14:17
log.20180509-141725</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 14:31
log.20180509-143108</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 14:44
log.20180509-144407</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 14:58
log.20180509-145806</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 15:20
log.20180509-152009</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 09-May-2018 18:59
log.20180509-185904</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 10-May-2018 00:10
log.20180510-001018</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 10-May-2018 09:11
log.20180510-091155</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 10-May-2018 13:57
log.20180510-135727</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 10-May-2018 21:50
log.20180510-215045</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 11-May-2018 07:34
log.20180511-073403</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 11-May-2018 13:24
log.20180511-132440</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 11-May-2018 17:13
log.20180511-171332</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 11-May-2018 22:00
log.20180511-220047</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 12-May-2018 11:08
log.20180512-110827</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 12-May-2018 15:30
log.20180512-153022</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 12-May-2018 17:42
log.20180512-174248</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 12-May-2018 22:29
log.20180512-222949</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 13-May-2018 10:03
log.20180513-100341</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 13-May-2018 14:26
log.20180513-142603</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 13-May-2018 22:53
log.20180513-225343</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 14-May-2018 07:58
log.20180514-075805</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 14-May-2018 11:35
log.20180514-113524</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 14-May-2018 16:27
log.20180514-162753</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 15-May-2018 01:31
log.20180515-013153</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 15-May-2018 08:58
log.20180515-085847</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 15-May-2018 12:30
log.20180515-123053</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 15-May-2018 18:24
log.20180515-182435</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 16-May-2018 07:25
log.20180516-072553</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 16-May-2018 08:55
log.20180516-085501</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 16-May-2018 12:01
log.20180516-120115</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 16-May-2018 19:46
log.20180516-194613</tt><tt class=""><br class="">
</tt><tt class=""> 1.0M 17-May-2018 06:14
log.20180517-061451</tt><tt class=""><br class="">
</tt><tt class=""><br class="">
</tt><b class=""><tt class="">real 0m18.965s</tt></b><tt class=""><br class="">
</tt><tt class="">user 0m0.018s</tt><tt class=""><br class="">
</tt><tt class="">sys 0m0.009s</tt><tt class=""><br class="">
</tt><br class="">
<br class="">
<br class="">
<div class="moz-cite-prefix">Am 17.05.2018 um 04:22
schrieb Mark Webb-Johnson:<br class="">
</div>
<blockquote type="cite" cite="mid:56C111E5-AC24-4BE2-8800-61616261D757@webb-johnson.net" class="">
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" class="">
<div dir="auto" style="word-wrap: break-word;
-webkit-nbsp-mode: space; line-break:
after-white-space;" class="">
<div class=""><br class="">
</div>
<div class="">Good grief. A year into this, and
still writing about SD CARD issues with ESP32. If
I could get into a room with the engineer who
decided to share boot strapping pins with SDCARD
pins, and to hard wire the SDIO controller to
specific pins, I would literally try to slap some
sense into him.</div>
<div class=""><br class="">
</div>
<div class="">The China guys and I have been
struggling for the past couple of months trying to
work out why we can’t get as much speed out of the
SD CARD as we wanted. If we raise the speed to the
normal 20MHz, we randomly get errors (timeouts,
checksums, etc). It looked like interference on
the bus lines, but scoping those we can’t find
any. Dropping the speed to 16MHz works around the
issue, but SD CARD accesses are slow.</div>
<div class=""><br class="">
</div>
<div class="">Then, we worked out it wasn’t random.
It was based on whether we were powering from USB
or external 12V. On the bench it works fine. In
the car the problem appears. Simply put, if the
USB was plugged in the ‘interference’ disappeared.
If USB was unplugged, it came back. USB + external
12V combination also didn’t suffer from the issue,
so the problem is not coming from the 12v side.
The issue often appeared on only the second test
of SD CARD, not the first. We didn’t see this
problem on either the v3.0 developer modules, or
v3.1 prototypes.</div>
<div class=""><br class="">
</div>
<div class="">We looked at the capacitors and
pull-up resistors on that side of the circuit,
without success. Whatever we did made little
difference (or randomly changed things for the
better/worse). We thought maybe ground-line
interference, but nope. We spent some time looking
at C20, C22, C23 to see if the manufacturers had
messed up the component values - they hadn’t.</div>
<div class=""><br class="">
</div>
<div class="">Anyway, to cut a long story short, we
finally found the culprit. The CP2102 chip itself.</div>
<div class=""><br class="">
</div>
<div class="">We’d already had to change the power
supply design early on in the project to cope with
a bug in CP2102 not correctly handling USB host
disconnect and not properly going into suspend
mode (to reduce power consumption of cp2101
circuit when usb was disconnected) - our current
design completely powers down the cp2102 chip when
the USB cable is disconnected. Michael Stegen had
previously warned me about clones of this chip
(see <a href="https://wiki.sha2017.org/w/Projects:Badge" class="" moz-do-not-send="true">https://wiki.sha2017.org/w/Projects:Badge</a>
and what they went through), and we had added the
extra resistor already to cope with that
eventuality. But, from what we can tell this is
not a clone part issue. Here is what we found:</div>
<div class=""><br class="">
</div>
<div class="">
<ol class="MailOutline">
<li class="">OVMS v3.0 and early v3.1 prototypes
use CP2102 v1412+. For that chip, when the USB
cable is disconnected, CSL-TXD is 3.3v.</li>
<li class="">OVMS v3.1 first production batch
use a newer CP2102 v1708+. For that chip, when
the USB cable is disconnected, CSL-TXD is
pulled down to 0.78v.</li>
<li class="">We have replaced the cp2102 on a
v3.1 first production module with v1412+, and
SD CARD resumes normal operation (even with
usb disconnected).</li>
<li class="">The version number seems to be a
date code. YYWW (year, week), I guess.</li>
<li class="">We have absolutely no idea why this
would be affecting the SD CARD performance or
interference. Somehow, that CSL-TXD line is
going through the ESP32 chip and affecting the
SDIO controller (perhaps related to the
bootstrapping pins dual use). The interference
we see is inside the ESP32, not on the lines
going from ESP32 to the SDCARD (which is why
we couldn’t see it on the scope).</li>
</ol>
</div>
<div class=""><br class="">
</div>
<div class="">I tried shutting down the pins on the
ESP32 for CSL-TXD and CSL-RXD, to see if I could
work around the problem in firmware, but couldn’t
get it to work. There is no way of knowing whether
the USB is connected, and even if we did know,
setting CSL-TXD and CSL-RXD pins to output mode,
or float, doesn’t seem to make any difference.</div>
<div class=""><br class="">
</div>
<div class="">The good news is that we’ve at least
identified the problem. We are (a) checking the
revision of cp2102 chip in the upcoming production
batch, and (b) changing QC procedures to set SD
CARD bus speed to default (20MHz) and randomly
test modules twice on 12V power. Latest production
batch is now using v1742+, and that has been
tested as working. Going forward, we can resolve
this.</div>
<div class=""><br class="">
</div>
<div class="">As for the first production batch
units, they are what they are. For normal SD CARD
operation (copying files, flashing firmware, etc),
it makes little difference. I guess most users
don’t even have an SD CARD inserted. The speed
limitation really only becomes an issue if you are
trying to log lots of data to SD CARD (such as CAN
bus dumps). If the USB is connected, you can
'config set sdcard maxfreq.khz 20000’ and it will
work faster. The CP2102 chip can be changed, and
I’ll do that for anyone that needs it. I’m asking
China to send me some from the latest production
batch that we know works. Replacement is
relatively straightforward, but involves
micro-soldering (the cp2102 is a surface mount
chip, very small footprint, with lots of other
components near it on the board).</div>
<div class=""><br class="">
</div>
<div class="">Regards, Mark.</div>
<div class=""><br class="">
</div>
</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.openvehicles.com" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br class="">
<pre class="moz-signature" cols="160">--
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.openvehicles.com" class="" moz-do-not-send="true">OvmsDev@lists.openvehicles.com</a><br class="">
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>OvmsDev mailing list</span><br><span><a href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a></span><br><span><a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a></span><br></div></blockquote></body></html>