SIMCOM support
Hello ofono guys,
I've got a embedded device with SIM5216E modem. Based on the previous work done by my colleague Jean-Christian de Rivaz (you can see previous talk on this mailing list about this modem "Some experiments with the SIMCOM SIM5216E modem on a ARM926 board"), the simcom AT doc, my MacGyver kit and my resourcefulness, i do a patch for ofono to support this modem (and maybe others models).
I attach the patch to this email.
While making this patch, I wondered about that :
* After entering a pin code, ofono goes too fast and checks too
early the sim pin status with "CPIN?". The ME responds "CME Error : 14 (SIM busy)" and ofono stops here. Ofono doesn't send more CPIN? or intercept the "+CPIN: READY" that the modem send after a while when SIM is back online. So, I use the same workaround that for ZTE : sending severals AT+CPIN? commands during 20 seconds until having "+CPIN:
READY". It works well but as my modem sends the "+CPIN: READY" from its own, I think I can use another mechanism more "standard" in ofono, isn't it ?
* I want to save power when i doesn't need the modem. So, i guess it
is the purpose of the "org.ofono.Modem.SetProperty" dbus method and the setting "Powered". When I set "Powered" to "False", I see ofono calls the "disable" callback of "struct ofono_modem_driver", so I think its here I must write the famous CFUN command(s) to put modem down. In the AT doc for SIMCOM, I have severals CFUN values for, i think, disable purpose :
0 – minimum functionality
4 – disable phone both transmit and receive RF circuits 7 – Offline Mode
For now, i do a CFUN=4 but maybe i need to do more and add CFUN=7 ? Or maybe use CFUN=0 ?
Can the "disable" callback be called by ofono in other case and so, i must only do a CFUN=4 ?
* I would like to do a reset of the modem at start and at end of
ofono life (with AT+CFUN=6 or AT+CRESET). The purpose is having a modem always in init state for ofono and the others programs. Do you think its a good idea ?
Best regards,
Anthony Viallard.
Add SIMCOM support.
I develop this with the SIM5216E chipset. SMS and GPRS work. I don't do the voice call part because i don't need it.
Makefile.am +3 -0
@@ -371,6 +371,9 @@ builtin_sources += plugins/samsung.c builtin_modules += sim900 builtin_sources += plugins/sim900.c +builtin_modules += simcom +builtin_sources += plugins/simcom.c + if BLUETOOTH builtin_modules += bluetooth builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
drivers/atmodem/sms.c +1 -0
@@ -805,6 +807,7 @@ static gboolean build_cnmi_string(char *case OFONO_VENDOR_NOVATEL :case OFONO_VENDOR_HUAWEI :case OFONO_VENDOR_ZTE : +case OFONO_VENDOR_SIMCOM :/* MSM devices advertise support for mode 2, but return an * error if we attempt to actually use it. */ mode ="1" ;
drivers/atmodem/sim.c +6 -0
@@ -1023,10 +1023,16 @@ static void at_pin_send_cb(gboolean ok, FALSE, cbd, g_free);return ;case OFONO_VENDOR_ZTE : +case OFONO_VENDOR_SIMCOM :/* * On ZTE modems, after pin is entered, SIM state is checked * by polling CPIN as their modem doesn't provide unsolicited * notification of SIM readiness. +* +* On SIMCOM modems, SIM is busy after pin is entered (we've +* got an "+CME ERROR: 14" at "AT+CPIN?" request) and ofono +* don't catch the "+CPIN: READY" message sent by the modem +* when SIM is ready. So, use extra CPIN to check the state. */ sd->sim_state_query = at_util_sim_state_query_new(sd->chat, 2, 20, sim_state_cb, cbd,
drivers/atmodem/network-registration.c +8 -1
@@ -1411,6 +1411,14 @@ static void at_creg_set_cb(gboolean ok, }switch (nd->vendor) { +case OFONO_VENDOR_SIMCOM : +/* Register for CSQ changes */ +g_at_chat_send (nd->chat,"AT+AUTOCSQ=1,1" , none_prefix, +NULL ,NULL ,NULL ); + +g_at_chat_register (nd->chat,"+CSQ:" , + csq_notify, FALSE, netreg,NULL ); +break ;case OFONO_VENDOR_PHONESIM :g_at_chat_register (nd->chat,"+CSQ:" , csq_notify, FALSE, netreg,NULL );
@@ -1534,7 +1537,6 @@ static void at_creg_set_cb(gboolean ok,break ;case OFONO_VENDOR_NOKIA :case OFONO_VENDOR_SAMSUNG : -case OFONO_VENDOR_SIMCOM :/* Signal strength reporting via CIND is not supported */ break ;default :
plugins/simcom.c new file +308 -0
308 lines not on this page · raw message
Hi Anthony,
Quoted 8 lines · Viallard Anthony
Hello ofono guys,
I've got a embedded device with SIM5216E modem. Based on the previous work done by my colleague Jean-Christian de Rivaz (you can see previous talk on this mailing list about this modem "Some experiments with the SIMCOM SIM5216E modem on a ARM926 board"), the simcom AT doc, my MacGyver kit and my resourcefulness, i do a patch for ofono to support this modem (and maybe others models).
How closely related is this one to SIMCOM 900? We already do have a plugin for it in the tree, so it might be a good idea to merge the two if they are closely related.
Quoted 2 lines
I attach the patch to this email.
Please use git send-email to send patches.
Quoted 12 lines
While making this patch, I wondered about that :
* After entering a pin code, ofono goes too fast and checks too early the sim pin status with "CPIN?". The ME responds "CME Error : 14 (SIM busy)" and ofono stops here. Ofono doesn't send more CPIN? or intercept the "+CPIN: READY" that the modem send after a while when SIM is back online. So, I use the same workaround that for ZTE : sending severals AT+CPIN? commands during 20 seconds until having "+CPIN: READY". It works well but as my modem sends the "+CPIN: READY" from its own, I think I can use another mechanism more "standard" in ofono, isn't it ?
oFono core expects the sim atom driver to return from PIN entry function when the SIM initialization procedures have been completed. Many modems have an unsolicited notification that is fired when this is done, to avoid CPIN? polling. Are you saying your modem fires off a 'CPIN:
READY' as an unsolicited notification? If so, then you can follow the same type of mechanism as VENDOR_IFX or VENDOR_STE
Quoted 11 lines
* I want to save power when i doesn't need the modem. So, i guess it is the purpose of the "org.ofono.Modem.SetProperty" dbus method and the setting "Powered". When I set "Powered" to "False", I see ofono calls the "disable" callback of "struct
ofono_modem_driver", so I think its here I must write the famous CFUN command(s) to put modem down. In the AT doc for SIMCOM, I have severals CFUN values for, i think, disable purpose :0 – minimum functionality
4 – disable phone both transmit and receive RF circuits 7 – Offline Mode
oFono expects the following:
Powered = True, Online = True -> Full functionality
Powered = True, Online = False -> RX/TX circuits down, SIM Card reader enabled
Powered = False -> Everything is powered down.
Quoted 4 lines
For now, i do a CFUN=4 but maybe i need to do more and add CFUN=7 ? Or maybe use CFUN=0 ?
You would need to find out what exactly those modes do.
Quoted 3 lines
Can the "disable" callback be called by ofono in other case and so, i must only do a CFUN=4 ?
disable is performed when the modem is powered down, either by normal means or when oFono daemon shuts down.
Quoted 5 lines
* I would like to do a reset of the modem at start and at end of ofono life (with AT+CFUN=6 or AT+CRESET). The purpose is having a modem always in init state for ofono and the others programs. Do you think its a good idea ?
In general that is not desirable. The modem should be initialized when the enable driver method is called. Why do you want to do this?
Regards,
-Denis
Quoted 3 lines · Denis Kenzior
How closely related is this one to SIMCOM 900? We already do have a plugin for it in the tree, so it might be a good idea to merge the two if they are closely related.
I don't known if SIM900 works with my driver plugin. SIMCOM were not given us this information whereas we inquired them. It will be glad if someone check it.
The only main difference i see between the two plugins, it's the AT+CSCS="GSM" command. I don't exactly why there is this command. Maybe its a behavior need it to work correctly with the operator where the guy has wrote the code and done the test. If someone tell me how to check (with an AT command ?) if we need this command, I will do the job.
In the SIMCOM doc, I see this about AT+CSCS :
- “IRA” : International reference alphabet.
- “GSM” : GSM default alphabet; this setting causes easily software
flow control (XON /XOFF) problems.
- “UCS2” 16-bit universal multiple-octet coded character set; UCS2
character strings are converted to hexadecimal numbers from 0000 to FFFF.
Quoted 3 lines
Please use git send-email to send patches.
ok.
Quoted 7 lines
oFono core expects the sim atom driver to return from PIN entry function when the SIM initialization procedures have been completed. Many modems have an unsolicited notification that is fired when this is done, to avoid CPIN? polling. Are you saying your modem fires off a 'CPIN: READY' as an unsolicited notification? If so, then you can follow the same type of mechanism as
VENDOR_IFXorVENDOR_STE
Right. My modem fires off a 'CPIN: READY' as an unsolicited notification. I will check the VENDOR_IFX or VENDOR_STE mechanism.
Quoted 8 lines
Quoted 5 lines
* I would like to do a reset of the modem at start and at end of ofono life (with AT+CFUN=6 or AT+CRESET). The purpose is having a modem always in init state for ofono and the others programs. Do you think its a good idea ?
In general that is not desirable. The modem should be initialized when the enable driver method is called. Why do you want to do this?
I guessed it will be nicer to have this but if you say no, ok, it was just an idea to have always a chips in same state at start and when ofono stops.
Thanks,
avd.
Hi Anthony,
Quoted 10 lines · Viallard Anthony
Quoted 3 lines · Denis Kenzior
How closely related is this one to SIMCOM 900? We already do have a plugin for it in the tree, so it might be a good idea to merge the two if they are closely related.
I don't known if SIM900 works with my driver plugin. SIMCOM were not given us this information whereas we inquired them. It will be glad if someone check it.
Quoted 6 lines
The only main difference i see between the two plugins, it's the AT+CSCS="GSM" command. I don't exactly why there is this command. Maybe its a behavior need it to work correctly with the operator where the guy has wrote the code and done the test. If someone tell me how to check (with an AT command ?) if we need this command, I will do the job.
If this is the only difference then the two plugins should be merged. Any minor variations can be taken care of by checking the model / firmware versions.
The CSCS command is used to set the character set. It is mostly used to make sure basic strings from the modem will be in a format we recognize (e.g. phone numbers, operator names, etc). This setting should generally be safe.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
* I would like to do a reset of the modem at start and at end of ofono life (with AT+CFUN=6 or AT+CRESET). The purpose is having a modem always in init state for ofono and the others programs. Do you think its a good idea ?
Quoted 7 lines
Quoted 2 lines
In general that is not desirable. The modem should be initialized when the enable driver method is called. Why do you want to do this?
I guessed it will be nicer to have this but if you say no, ok, it was just an idea to have always a chips in same state at start and when ofono stops.
The chip should be powered down in disable(), so in theory it will be in the same state prior to oFono starting. Maybe I'm mis-understanding what you're trying to do.
Regards,
-Denis
Hi Denis,
2013/1/24 Denis Kenzior
Quoted 11 lines
Hi Anthony,
Quoted 7 lines · Viallard Anthony
On 24. 01. 13 17:21, Denis Kenzior wrote:
How closely related is this one to SIMCOM 900? We already do have a
Quoted 3 lines
plugin for it in the tree, so it might be a good idea to merge the two if they are closely related.
In near time I'll begin rework plugin for SIM900 . I'll want replace external cmux with the internal oFono gatmux, and add GPRS. But I think merge is possible. Only one question is actual to me - we use voice calls in SIM900, and during merge this functionality must be saved.
Quoted 6 lines
Quoted 5 lines
I don't known if SIM900 works with my driver plugin. SIMCOM were not given us this information whereas we inquired them. It will be glad if someone check it.
Ok, I can check your plugin with SIM900 in near time.
Quoted 8 lines
Quoted 8 lines
The only main difference i see between the two plugins, it's the AT+CSCS="GSM" command. I don't exactly why there is this command. Maybe its a behavior need it to work correctly with the operator where the guy has wrote the code and done the test. If someone tell me how to check (with an AT command ?) if we need this command, I will do the job.
Quoted 9 lines
If this is the only difference then the two plugins should be merged. Any minor variations can be taken care of by checking the model / firmware versions.
The CSCS command is used to set the character set. It is mostly used to make sure basic strings from the modem will be in a format we recognize (e.g. phone numbers, operator names, etc). This setting should generally be safe.
From SIM900 AT command manual:
"The SIM900 AT Command interface defaults to the IRA character set.", so we use AT+CSCS="GSM" for compatibility with settings of our provider.
Quoted 19 lines
* I would like to do a reset of the modem at start and at end of ofono
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
life (with AT+CFUN=6 or AT+CRESET). The purpose is having a modem always in init state for ofono and the others programs. Do you think its a good idea ?
Quoted 9 lines
Quoted 3 lines
In general that is not desirable. The modem should be initialized when the enable driver method is called. Why do you want to do this?
I guessed it will be nicer to have this but if you say no, ok, it was just an idea to have always a chips in same state at start and when ofono stops.
The chip should be powered down in
disable(), so in theory it will be in the same state prior to oFono starting. Maybe I'm mis-understanding what you're trying to do.
Quoted 7 lines
Regards,
-Denis
______________________________**_________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/**listinfo/ofono<http://lists.ofono.org/listinfo/ofono>
Best regards,
Renat Zaripov