[Ovmsdev] Twizzy Rental Service

Mark Webb-Johnson mark at openvehicles.com
Tue Mar 8 16:24:12 HKT 2016

An update on SIM808. It is just a stop-gap solution, but it buys us some time.

The changes I’ve made / problems I’ve had:

Power button needs to be held for 1 second to power down/up the modem (SIM908 was much faster). Not a bad issue, but it did waste a week going back and forth trying to find the cause.
The SIM808 doesn’t echo LineFeed characters. That is a pain for DIAG mode console, but doesn’t affect anything else. Only workaround possible is to use a terminal program that can map CR->CRLF, or CF->LF (and live with the horrible display in DIAG mode). We’ll just develop on SIM908 modules or use a fancy terminal emulator. I guess if people are using scripts to talk to DIAG mode, they may need some tuning if they are expecting CRLF and just getting CR now.
GPS initialisation (this is the biggy - more below).
Build profile in version string. This is just a simple fix to include a #define in the build profiles, and to include that where we show the version string. It means that as well as the version of firmware, we can now see the build profile. Helpful for support of new users.

The biggest issue has been with GPS initialisation.

Looking at the current code:

// Using internal SIM908 GPS:
rom char NET_INIT1[] = "AT+CGPSPWR=1;+CGPSRST=0;+CSMINS?\r";
rom char NET_REQGPS[] = "AT+CGPSINF=2;+CGPSINF=64;+CGPSPWR=1\r";
// Using external GPS from car:
rom char NET_INIT1[] = "AT+CSMINS?\r";

So, if the build profile includes OVMS_INTERNALGPS (ie; one or more vehicles in the profile require GPS), then we use a big sequence of initialisations "AT+CGPSPWR=1;+CGPSRST=0;+CSMINS?\r”. We have two issues with this:

We’re powering up the GPS, even if the actual vehicle we selected doesn’t need SIM908/808 GPS. That costs watts - and with my new fancy bench power supply I got for OVMS v3 development (ok, cheap chinese ebay) I can now see exactly how much ;-).
The SIM808 randomly doesn’t like AT+CGPSPWR=1 and in particular seems to hate it 100% of the time it is included with other options. You get an ERROR response back from the modem, and as this is done in NET_STATE_DOINIT, it looks like a SIM card error (but is nothing to do with SIM card). We just never saw AT+CGPSPWR=1 fail on SIM908.

Now, as well as the #defined OVMS_INTERNALGPS to enable the SIM908/808 GPS, we’ve also got NET_FN_INTERNALGPS in net_fnbits which is set during vehicle module initialisation. The first brings in the code, the second should turn it on. Except it doesn’t. The first one turns it on.

Accordingly, I’m having to change the net.{h,c} layer to split off GPS initialisation into its own states and use a simple AT+CGPSPWR=1 for vehicles that require SIM908/808 GPS and AT+CGPSPWR=0 for vehicles that don’t. I’ve taken the opportunity to switch from using OVMS_INTERNALGPS to using NET_FN_INTERNALGPS in net_fnbits as the decision as to whether to power up the SIM908/808 GPS or not.

Building and testing that has taken me the most time. It is almost done, and I should be able to commit the code soon.

Production firmware then goes to the manufacturer in China, and we give the go-ahead for the production run. We should have the modules back in stock towards the end of March / first thing in April.

Regards, Mark.

P.S. I can actually recommend that cheap(ish) chinese ebay power supply. It’s available from various eBay sellers, or banggood <http://www.banggood.com/CPS-3205C-0-32V-0-5A-Portable-Adjustable-DC-Power-Supply-180-264V-p-974495.html>. Controls are precise, output is rock solid, ammeter is as accurate as my multi-meter, and it is built like a tank.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160308/08015541/attachment.htm>

More information about the OvmsDev mailing list