3

I used to work with GM862-QUAD-PY module from Telit (link here: http://www.telit.com/en/products.php?p_ac=show&p=4). This module has a built-in Python interpreter. For a long time, I use it as a single module GSM/GPRS solution. I basically write Python scripts that sends and receive AT commands to the GSM part of the module itself. Using Python, I can also reach its GPIO pins, UART, bitbanging SPI and I2C buses.

However, this python interpreter has strong limitations. It is only good for small projects. There is no support for threads or any type of interrupts or signals. So python programs written must feature a big super loop. In my application, the GM862 module reads incomming data from UART and process it and upload them to a GPRS server. Meanwhile, it also reads commands sent from SMS or the GPRS server. As more users use my system (which means more data at UART and more SMS commands to the system), the super loops gets slower and slower. Optimizing the python program doesn't help much and even obfuscates my code.

Finally, I decided to switch to an embedded linux platform. Telit has GE863-PRO which is a embedded linux version of GSM/GPRS module but its development kits are difficult to obtain. Now I am looking at Beaglebone. I will be using GM862-QUAD-PY the normal AT-command way. However, AT commands are slow to deal with. Certain commands can take as much as 15 seconds to complete. In the original Python code, I simply wait until there is an AT response. After that, I do something else which doesn't involve AT commands.

Since I am in linux now and have Pthreads to play with, I want to make full utilization of the GSM module and increase its throughput. Here is my initial idea. I make a AT command pending queue. Each element in queue consists of the AT command itself and a callback function. I create a thread that takes AT commands from that queue and sends out via UART and the thread polls for responses. When there is response, the thread will call the callback function.

Because I am new to embedded linux and Pthreads, I want to know if this is the best way to achieve high utilization of the GSM/GPRS module and if there is any good existing libraries I could take advantage of.

Thanks in advance.

foresightyj
  • 2,006
  • 2
  • 26
  • 40
  • 1
    http://lxr.free-electrons.com/source/Documentation/serial/n_gsm.txt – artless noise Mar 01 '13 at 03:26
  • Any results on this topic/question? – Matthew Eshleman Jan 23 '15 at 03:28
  • I was new to the world of threads and asynchronous IO at the time when I asked the question. I don't work on that project any more. But what I was asking can be solved by `select` or `epoll` or simply using threads. I am no expert in linux system calls so you can dig further into that area. It is an established problem in computer science. Related keywords I know of are: green threads, co-routines, asynchronous I/O. Simply checkout Asynchronous IO page in wikipedia (http://en.wikipedia.org/wiki/Asynchronous_I/O), which will lead you to a lot of topics. – foresightyj Jan 23 '15 at 05:10

1 Answers1

0

Your solution will definitely work. If you have never used linux and pthreads that's a neat project to learn how to use them.

I can't say ho fast it will be though because some AT commands can take a few seconds to run. I would start by benching your AT commands with a serial terminal to see if it's worth changing implementing your pending queue.

If you're connecting to a server over GPRS, you should look into ppp.

hyves
  • 11
  • 2