BG95M3 Android(7.1) RIL

I am working my way through getting the BG95-M3 integrated with Android’s RIL.

Here is a link to the Radio output:

I appears that the RIL library is trying to use CMUX.

01-01 00:14:36.302 V/use-Rlog/RLOG-RIL MUXD( 2269): 729:syslogdump(): >s 00000000: 41 54 2b 43 4d 55 58 3d-30 2c 30 2c 35 2c 31 32 AT+CMUX=0,0,5,12
01-01 00:14:36.302 V/use-Rlog/RLOG-RIL MUXD( 2269): 729:syslogdump(): >s 00000010: 37 0d 0a . . . . .- . . . . . . . . 7…
01-01 00:14:36.302 V/use-Rlog/RLOG-RIL MUXD( 2269): 1378:chat(): Wrote 19 bytes
01-01 00:14:36.302 V/use-Rlog/RLOG-RIL MUXD( 2269): 1380:chat(): CHAT++++++++++++
01-01 00:14:36.309 V/use-Rlog/RLOG-RIL MUXD( 2269): 1391:chat(): Selected 1
01-01 00:14:36.410 V/use-Rlog/RLOG-RIL MUXD( 2269): 1398:chat(): Read 17 bytes from serial device
01-01 00:14:36.411 V/use-Rlog/RLOG-RIL MUXD( 2269): 729:syslogdump(): <s 00000000: 0d 0a 2b 43 4d 45 20 45-52 52 4f 52 3a 20 33 0d …+CME ERROR: 3.
01-01 00:14:36.411 V/use-Rlog/RLOG-RIL MUXD( 2269): 729:syslogdump(): <s 00000010: 0a . . . . . . .- . . . . . . . . .
01-01 00:14:36.411 V/use-Rlog/RLOG-RIL MUXD( 2269): 1408:chat(): Received ERROR

It tries this over and over again.

I think I read that CMUX only works on the UART connection, not the USB connection.

How do I get the RIL library not to try and use CMUX?

Also, what version of the RIL library should I be using? I was sent v2.6.7, but looking through the included document the BG95 is not listed as a supported modem. On the forums here I found a copy of v2.8.8 and v2.9.6.

I am running Android 7.1.1 on a custom PCB.

I got the latest RIL library from support (v3.3.32).
This version makes it farther but I’m still not there yet.
Everything looks pretty good until it tries to establish the PPP connection.

Here is a cut portion of the radio log:

12-31 19:14:22.116 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT&D2
12-31 19:14:22.119 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.120 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT+CFUN?
12-31 19:14:22.121 D/CdmaSSM ( 1137): subscriptionSource from settings: 0
12-31 19:14:22.123 D/use-Rlog/RLOG-RIL ATC( 2138): AT< +CFUN: 1
12-31 19:14:22.123 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.124 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT+COPS=3,2;+COPS?
12-31 19:14:22.128 D/use-Rlog/RLOG-RIL ATC( 2138): AT< +COPS: 0,2,“310410”,8
12-31 19:14:22.128 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.128 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT+CEREG?
12-31 19:14:22.131 D/use-Rlog/RLOG-RIL ATC( 2138): AT< +CEREG: 2,1,“9800”,“64B5608”,8
12-31 19:14:22.131 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.131 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT+QICSGP=1,1, “phone”,“”,“”,0;+QICSGP=1
12-31 19:14:22.133 D/QtiGsmDCT( 1137): [0]trySetupData: X retValue=true
12-31 19:14:22.134 D/use-Rlog/RLOG-RIL ATC( 2138): AT< +QICSGP: 1,“phone”,“”,“”,0
12-31 19:14:22.134 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.134 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): requesting data connection to APN ‘phone’!
12-31 19:14:22.135 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT+CGDCONT=1,“IP”,“phone”
12-31 19:14:22.141 D/use-Rlog/RLOG-RIL ATC( 2138): AT< OK
12-31 19:14:22.141 D/use-Rlog/RLOG-RIL ATC( 2138): AT> AT^DATAMODE
12-31 19:14:22.144 D/use-Rlog/RLOG-RIL ATC( 2138): AT< ERROR
12-31 19:14:22.145 D/use-Rlog/RLOG-RIL PPPD( 2138): pppd_thread_function ///0/99**1# enter
12-31 19:14:22.148 D/use-Rlog/RLOG-RIL PPPD( 2138): chat → AT
12-31 19:14:22.649 E/use-Rlog/RLOG-RIL PPPD( 2138): chat poll error on stdin: Success(0)
12-31 19:14:23.147 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:23.147 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [1] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:24.151 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:24.151 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [2] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:24.674 D/use-Rlog/RLOG-RIL PPPD( 2138): chat → AT
12-31 19:14:25.153 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:25.153 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [3] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:25.176 E/use-Rlog/RLOG-RIL PPPD( 2138): chat poll error on stdin: Success(0)
12-31 19:14:26.157 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:26.157 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [4] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:27.160 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:27.160 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [5] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:27.207 D/use-Rlog/RLOG-RIL PPPD( 2138): chat → AT
12-31 19:14:27.708 E/use-Rlog/RLOG-RIL PPPD( 2138): chat poll error on stdin: Success(0)
12-31 19:14:28.164 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:28.164 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [6] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:29.167 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:29.167 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [7] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:29.738 D/use-Rlog/RLOG-RIL PPPD( 2138): chat → AT
12-31 19:14:30.171 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:30.171 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [8] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:30.240 E/use-Rlog/RLOG-RIL PPPD( 2138): chat poll error on stdin: Success(0)
12-31 19:14:31.176 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:31.176 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [9] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:32.178 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:32.178 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [10] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:32.273 D/use-Rlog/RLOG-RIL PPPD( 2138): pppd_thread_function exit
12-31 19:14:33.180 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ppp0 IP Address: 0.0.0.0/0
12-31 19:14:33.180 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): [11] trying to get_local_ip … 0.0.0.0/0
12-31 19:14:33.180 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): ql_set_data_call_info_for_ppp pdp=1, ifname=ppp0, iptype=4, ipaddr=(null)
12-31 19:14:33.180 D/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): get_local_ip: 0.0.0.0/0, cost 11 sec
12-31 19:14:33.180 E/use-Rlog/RLOG-RIL SETUP_DATA_CA( 2138): Unable to setup PDP in requestSetupDataCall
12-31 19:14:33.180 D/use-Rlog/RLOG-RIL ATC( 2138): AT> at+qcfg=“modemrstlevel”,0
12-31 19:14:33.181 D/RilRequest( 1137): [3780]< SETUP_DATA_CALL error: com.android.internal.telephony.CommandException: GENERIC_FAILURE ret=

What is “AT^DATAMODE”?

I am able to manually setup a PPP connection but I have questions about the PPP scripts:

What ttyUSB port should I have in the quectel-ppp script when using Android RIL to create the PPP connection? I have tried both ttyUSB2 and ttyUSB3 but it doesn’t seem to make a difference.

Is Android RILs in charge of setting up that PPP connection or do I need to do that myself before starting the ril-daemon?

Thanks!

So I went digging for the ‘AT^DATAMODE’ command and it is definitely coming from the v3.3 RIL driver.

$grep “AT^DATAMODE” -A 4 -B4 -a libreference-ril.so

= %sFILEENDFTPENDHTTPENDSTARTENDstage = %s:%dAT ERRORAT^DATAMODE^DATAMODE:RIL SETUP_DATA_CALL!!!PPP link is disconnected after sleep modeIPv4IPv6

I was wondering if my BG95-M3’s firmware might be the issue.
It is running BG95M3LAR02A03, is this the current version?

Has anyone out there successfully integrated the BG95 into Android’s RIL?
I’d love some pointers or even a general tutorial (the few online I’ve found aren’t helping much).

I went through the RIL Integration Guide once more to see if I missed anything and found this under “Why Phone Process Does not Work

I highlighted to two files that I could not find on my device, at least not in those directories.
Does rild need to be in vendor/bin/hw/? Mine is in /system/bin/
Pretty much the same with libril.so, its in /system/lib/ not /vendor/lib/, I just assumed it didn’t make a difference.
Is /vendor/lib/libril.so the same as libreference-ril.so that was provided with the Quectel RIL driver?
Also, where do I get /vendor/bin/rild?

Sorry if these are pretty basic RIL questions, I’ve never gone through this process before.

Thanks!

Bg95 Android RIL driver and cmux are two independent parts,

I attached one BG95 CMUX doc for your reference ,Quectel_BG95&BG77&BG600L_Series_MUX_Application_Note_V1.0.pdf (712.8 KB)

anymore support ,pls send email to support@quectel.com

Just so someone else that is trying to integrate the BG95-M3 into the RIL in the future will know: I am being told by support that the only way the BG95 can be integrated is by using the UART connection, not the USB.
Then using CMUX will work and then it can be used by the RIL.

Hello @Stephen.Li-Q @mslaMaker.
I have this exact same issue with RIL, with this log BG95M3 Android(7.1) RIL. We have a USB connection but are using ttyUSBx for communications. I’m not sure what ‘not the USB’ means in this context.
This is quite odd as we use the BG96 in exactly the same way with no issue, in fact we only moved to BG95 because the BG96 was not available.
@Stephen.Li-Q I would appreciate any additional help on getting this running.