Home Page Forums Raspberry Pi Shields PPP with CMUX, ldattach and Quectel M95

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #67680
    SockThief
    Participant

    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 /dev/serial0.

    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 1

    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 shows

    and I get the expected 4 ttyGSM devices.

    Modifying my original Python script to point to /dev/ttyGSM1 (instead of /dev/serial0) I can send AT commands still

    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/ttyGSM1 then I see the following

    If I reboot and don’t run the cmux code, and try to pon a ppp connection (using /dev/serial0) it fails

    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/serial0 it 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 guide

    • This topic was modified 2 weeks ago by SockThief. Reason: fixing code tags
    • This topic was modified 2 weeks ago by SockThief. Reason: Fix links
    #67848
    SockThief
    Participant

    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!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.