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
- Use AT commands to configure settings and send and receive messages
- 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
- Using GPRS and GSM Simulatneously
- 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
- I followed this http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/ tutorial and downloaded the right linux headers for my BBB.
- I tried to compile the module as a Linux LKM (Loadable kernel module) as follows
- I downloaded the n_gsm.c from here https://github.com/torvalds/linux/blob/master/drivers/tty/n_gsm.c
- The n_gsm.c file had some includes which were missing in my BBB. So I downloaded them.
- 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
- 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.
- I feel I'm making some obvious errors as it looks we people were able to load this module successfully.
- Is this the right way to load a module and specifically n_gsm. There isn't much document/tutorial on this.
- 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
- kernel - Linux beaglebone 3.8.13-bone79
- Distro - Debian 7.9 (wheezy)
Edit 2 : Added details about GSM module
- This is the GSM breakout board I'm using.
- It uses this module and you can checkout the command manual and multiplexing application note.
Update 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.
- AT+CMUX=?, AT+CMUX? and AT+CMUX= geneated an error on the sim800H module.
- 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