28 November 2019 at 10:20 AM #67680SockThiefParticipant
Full Disclaimer! I am not currently a customer. However, I have a cart full and just waiting to see if there will be anything for Black Friday (if there’s nothing coming , i’ll pull the trigger and order now!). One of the parts on order is the Raspberry Pi GPRS/GPS Tracker HAT (Quectel M95 Based). Whilst I wait for my order to come though I am prototyping with another M95 board connected to my Pi (though I am very much looking forward to getting the Tracker HAT) and my problem is still valid so I hope to solve the code issue before the HAT comes, make some minor updates and keep developing.
Full Disclaimer #2: I originally posted this to the Raspberry Pi Forum (https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=257680&p=1571217&hilit=ppp#p1571217) However I received no answer there, and whilst buying the Quectel HAT noticed there was a forum here, so was hoping someone here could help me out!
I have a Raspberry Pi B+ with a Mikroe Pi Click Shield (https://www.mikroe.com/pi-3-click-shield), and Mikroe Click GSM2 (https://www.mikroe.com/gsm-2-click) which is based on the Quectel M95 module. (As above, the Click will be replaced by the Tracker HAT as soon as it arrives)
I installed Raspbian Buster Lite and was able to, using a Python script, send AT commands to the modem via
I followed this up by configuring a PPP connection using the standard chat scripts, again via
/dev/serial0, and it worked perfectly. I got a ppp0 connection, configured the default route and I had full internet access as expected. So far so good.
As a lot of people, I want to be able to send AT commands to the modem when the PPP connection is active – this might be to send an SMS, or read the status of the modem. However, since the PPP connection has ownership of the serial device, this is not possible. Reading the M95 documentation, there is only a single serial port, however it does support CMUX – so in theory I should be able to enable cmux, then create virtual serial devices to keep the PPP connection active on one and send AT commands on the other. (as an aside – I note that I can also send an escape sequence ‘+++’ to the modem when in data mode to temporarily switch to command mode without dropping the connection, though I suspect this doesn’t work when PPP is in use – can anyone confirm or deny this?)
Playing with various settings, options and reading – I was not able to get ldattach to work, and I soon discovered from google that the n_gsm module was not in the standard kernel. I found this guide – https://github.com/guowenxue/embedded_project/tree/master/program/ldattach_gsm0701 and performed step 1123456Choose follow option when do "make menuconfig" before cross compile linux kernel:Device Drivers --->Character devices ---><*> GSM MUX line discipline support (EXPERIMENTAL)
then followed the standard kernel building process to build a new kernel with n_gsm; on reboot everything came up as expected.
I then compiled this project for a cmux controller https://github.com/Rtone/cmux which worked fine (though I did have to modify the code to point to /dev/serial0 and also changed the mtu for cmux to 127 from 512 as that is what the M95 supports) – this works great and on running it shows1234567...Line dicipline setCreated /dev/ttyGSM1Created /dev/ttyGSM2Created /dev/ttyGSM3Created /dev/ttyGSM4Going to background
and I get the expected 4 ttyGSM devices.
Modifying my original Python script to point to
/dev/serial0) I can send AT commands still12345678OKAT+IFC=2, 2OKAT+GMMQuectel_M95OK
But I can’t for the life of me get my PPP connection to run any more – If i change the peers file to point to
/dev/ttyGSM1then I see the following123456789Nov 25 06:54:27 68imgw01 chat: abort on (+CGATT: 0)Nov 25 06:54:27 68imgw01 chat: send (AT^M)Nov 25 06:54:27 68imgw01 chat: timeout set to 12 secondsNov 25 06:54:27 68imgw01 chat: expect (OK)Nov 25 06:54:39 68imgw01 chat: alarmNov 25 06:54:39 68imgw01 chat: FailedNov 25 06:54:40 68imgw01 pppd: Hangup (SIGHUP)
If I reboot and don’t run the cmux code, and try to pon a ppp connection (using
/dev/serial0) it fails12345678Nov 25 06:55:51 68imgw01 chat: send (AT^M)Nov 25 06:55:51 68imgw01 chat: timeout set to 12 secondsNov 25 06:55:51 68imgw01 chat: expect (OK)Nov 25 06:55:51 68imgw01 chat: FailedNov 25 06:55:59 68imgw01 pppd: Terminating on signal 15Nov 25 06:55:59 68imgw01 pppd: Exit.
given where the pon fails, at the first AT command, I suspect it is not able to communicate with the serial device, but I can’t work out why. After all when I run the cmux code which points at
/dev/serial0it works just fine, but on a fresh reboot pon doesn’t…
any help is appreciated! (I also note that SixFab have some cool code that might simplify this, but that wouldn’t teach me anything 🙂 )
I have referred a lot to this StackOverflow post : https://stackoverflow.com/questions/28939656/sending-at-commands-to-sim900-whilst-pppd-is-active which is a very simillar approach and use case – it also references the above cmux project and kernel building guide28 November 2019 at 7:57 PM #67848SockThiefParticipant
Can’t update a second time, but happy and proud to say I am NOW a paying customer with an M95 based board on the way!
- You must be logged in to reply to this topic.