SMS and GPRS: Multiplexing GSM module on BeagleBone Black using n_gsm

博主使用BeagleBone Black搭配Simcom 800H蜂窝模块,想通过AT命令配置和收发消息、用ppp经GPRS上网,但不能同时进行。尝试加载n_gsm模块失败,按步骤编译仍有问题。后在他人帮助下构建模块但GSM模块无法进入mux模式,AT+CMUX命令在sim800H上出错。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 


I'm using simcom 800H cellular module with my BeagleBone Black which is very similar to the popular simcom 900. I want to do two main things with the simcom module

  1.           Use AT commands to configure settings and send and receive messages
  2.           Use ppp to enable internet access on the BBB through GPRS.

Now the obvious problem is that I cannot do both at the same time. I did a web search and found the following posts

  1.     Using GPRS and GSM Simulatneously
  2.    Sending AT commands to SIM900 whilst pppd is active

The 2nd link has been particularly useful where one of the user has used the code on this repository. https://github.com/Rtone/cmux

The common theme has been to use the n_gsm module. I tried to load the module using modprobe n_gsm and it failed. Like the user mentioned the BBB also doesn't include the n_gsm module as default so I had to go and build a new kernel with n_gsm

added as a module. However I'm having issues with including the n_gsm as a module. Here are the steps I followed      

  1. I followed this http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/ tutorial and downloaded the right linux headers for my BBB.
  2. I tried to compile the module as a Linux LKM (Loadable kernel module) as follows
  3. I downloaded the n_gsm.c from here https://github.com/torvalds/linux/blob/master/drivers/tty/n_gsm.c
  4. The n_gsm.c file had some includes which were missing in my BBB. So I downloaded them.
  5. I created a makefile. My directory had n_gsm.c and Makefile

Makefile

         

obj-m += n_gsm.o

all:
       make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
       make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

 

This generated errors as shown in figure

 

  1. I was able to successfully load a different module as shown in this http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/(the hello world of kernel modules). I also dont understand why I need to recompile the entire linux kernel to create a LKM.
  2. I feel I'm making some obvious errors as it looks we people were able to load this  module successfully.
  3. Is this the right way to load a module and specifically n_gsm. There isn't much document/tutorial on this.
  4. Is there a simpler way to do this multiplexing in case all thisdoes not workout? I really like the idea of AT commands for SMS and PPP for GPRS (instead of AT commands for both).

Any tips and suggestions will be really helpful!

Edit1 : Details about my BBB

  1. kernel - Linux beaglebone 3.8.13-bone79
  2. Distro - Debian 7.9 (wheezy)

Edit 2 : Added details about GSM module

  1. This is the GSM breakout board I'm using.
  2. It uses this module and you can checkout the command manual and multiplexing application note.

Update 1

  1.  Thanks to @Serge, I was able to build the n_gsm module and add it without re-compiling the kernel. However, I still haven't been able to get the GSM module into mux mode.
  2. AT+CMUX=?, AT+CMUX? and AT+CMUX= geneated an error on the sim800H module.
  3. Here's the de-bugging I have done

            1  Played around with hardware/software and no flow. Didnt work in any mode.
            2 Set TE-TA fixed local rate AT+IPR to auto, 115200 and still AT+CMUX generates an error
            3  Tested AT+CMUX? on another sim900 module and that works.

 

Any idea why it does not work with sim800H?            


 

ifneq ($(KERNELRELEASE),)

obj-m += KmemleakTest.o
KmemleakTest-objs := kmemleak_test.o
else

    KERNELDIR ?= <源码目录>/out/target/product/poplar/obj/KERNEL_OBJ
    PWD ?= $(shell pwd)
    ARCH = arm64
    CROSS_COMPILE=<源码目录>/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

.PHONY: modules clean

modules:
    $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(PWD) modules
    
clean:
    @rm -rf *.o *.order *.symvers *.mod.* .*.o.cmd .*.mod.o.cmd .*.ko.cmd .tmp_versions *.ko

endif

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值