28 thoughts on “#SPCM

  1. Hi.
    I’m download new AT reference Guide r10 and see new AT command.

    #SPCM is very interest command for read or send PCM audio from to serial port but:
    for more user can’t use this new command.
    if some one use python script then can’t read this data because are routed from to serial port (or not???) . and other user what use small 8bit mcu then don’t have more free memory to store this data, need connect any SPI or I2C external memory. Only user what use bigger MCU with more free flash (ARM7 or better) then can use this as voice recorder.

    why you engineer don’t make support record this data to internal flash used for python script. there is 1.9MB free internal flash and 1MB ram. record to any defined file . and then play from this file. not long time , just for few sec. I don’t know what is sample frequency but if is 8kHz then 10sec is used only 80kB from 1.9MB.

    this function is more usable like #SPCM .

    on this time can use this command but must put to PCB board big free memory for store this sample.
    what minimal UART speed is need to read write this PCM data to – from module???


    1. #SPCM is very interest command for read or send PCM audio from to serial port but: for more user can’t use this new command. if some one use python script then can’t read this data because are routed from to serial port (or not???) . and other user what use small 8bit mcu then don’t have more free memory to store this data, need connect any SPI or I2C external memory. Only user what use bigger MCU with more free flash (ARM7 or better) then can use this as voice recorder.

      PCM stream can be stored on python modules since the stream is sent out of MDM interface. From MDM it can be read and stored into a file or a variable. Anyway there are few limitations:

      – We suggest not to use the FileSystem for continuos recording. This because
        the flash erase/prog are limited.
      – Playback will need some RAM to load buffer from Flash. This memory will be  
        allocated from Python Script, so if Script will use all the RAM, playback 
        cannot work properly.

      We recommend to work at 115200bps.

      1. Hi Andrea.

        It’s good news.

        But I’m use only short time python script . it’s not good for me application.

        Therefore, please answer me these questions if possible.

        How could we communicate with internal python script so that if need then read data from GSM module (PCM audio) to defined file . and if is request then send this data to GSM module (play) .

        I want record data only once (max 5 file with max 10 sec length) . and then only play it if need. it use 5*10*8000 = 400 kBytes flash . 

        Can you write any solution how to use external MCU and store audio to flash mem in GSM module ??




        1. … as I suggested elsewhere before: Python app implements a bridge between serial port (your micro commands) and MDM (modem). Only at the needed time take command and do the PCM job, the playback. But this needs to be tweaked, proved to be feasible, shaped on your micro application.


          1. for this time I don’t know where start.
            I thinks so script must use MDM and SER .

            But I don’t know if python script can listen on SER request from external MCU .

            if detect request then communicate with modem and can record PCM or send .. .


            Cosmin can you write more how can do that or what is possible ????

          2. Simply read from SER, write to MDM, and viceversa, read from MDM, write to SER.

            If data from SER contains a special command, say PCMx, read file x from flash and use AT#SPCM to send it over MDM.

          3. Cosmin I don’t know if must be full complete bridge . what MCU send to GSM send to python script and python script send data to modem or , can use tis bridge only if need , other time communicate directly with modem.


            pls . write more if it possible ..




          4. hmmmm.
            I can normal communicate with modem???

            but on background  python script still run and my MCU can communicate with this script?? I defined special command and if send then what??? modem respond error??? 


          5. Is not possible to have Python app running and the modem still available on the serial interface, this is why you need full bridge.

            Well, you can start the Python app from the serial interface, do the PCM job within it, then quit the app and return to the serial interface, but I see this more complicated and time consuming.

            In my opinion is much easier to hook a small SPI or I2C memory to your micro and let it work directly.

          6. use external mem is problem , if use eeprom then problem with timing , is possible use only fram ,


            # ESCRIPT this command run python script when I want or not .

            I read documentation but don’t good understand.

            is possible to run my application from MCU and do all what want but if want record or play audio then run internal script and python script record or play audio from to file . after finish . script stop and my MCU will have again full control on modem.


            is it possible ??



          7. Yes is possible, exactly what I wrote above – but needs time to start/stop the scripts.


            Why eeprom only, Atmel makes for example fine SPI flash memories with important capacities, see here for example.

          8. on documentation of this mem : AT45DB011D time to write page to mem is about 2ms. it’s long time . 

            I must think about it.
            how I can stop run internal script ??? , I can’t find any at command . only run . yes is it possible to reboot .



          9. A page for that memory is 264 bytes long; and you said will write once and only read after.


            A script exits once it reaches its end, or rebooting the module of course.


            See in "Easy Script in Python" page 83, "Run AT Interface and Python at the same time", so is possible, my previous statement was wrong, sorry.

          10. on standard I2C mem if buffer is fill with data then this data are write to mem, and (this I think) while data are not stored to mem then for this time I can’t send new data .


            if set this AT#STARTMODESCR=2 mode then can on real time run my command from MCU and run python script . but how to communicate with script ??? hmmm .
            use external GPIO pin or ???? hmm … .

          11. You can use file pipe, write from microcontroller with AT#WSCRIPT and read in Python with standard file operations.

            Or simply use separate scripts for each file playback, running the one you need at a time.


          12. Hi Cosmin.

            First question is :

            with this command (AT#STARTMODESCR= ) we can control if ASC0 (My MCU)  communicate on first AT parser instance or in third.

            is possible use this AT command anytime?? no script will be defined as active , no script will be run. IF yes then we can with easy command change AT parser  instance.

            If I’m use first then switch to third with command  #STARTMODESCR=2 , and if want go back then #STARTMODESCR=0 , is it wright???



          13. AT#STARTMODESCR=2 your micro talks on the 3rd parser.

            AT#STARTMODESCR=0 your micro talks on the 1st parser.

            Changing mode requires reboot as far as I can see, because of CMUX activation/deactivation.  The parser number is important only because of the different settings set applied.



             Normally, the AT command interface on ASC0 is connected to the first AT instance parser (in case we’re using
            the   serial   port   with   or   without   CMUX   and   there   is   no   Python   script   running)   while   in   case   of
            AT#STARTMODESCR=2,  CMUX  is  activated  and  the  third  CMUX  port  will  be  used  for  AT  command  interface
            (which means that the settings from the third AT instance parser will be applied). 

          14. I test it .

            normal I have set AT#STARTMODESCR=0 and send this for control what parser instance use : AT#QSS? and return 2,3 .

            then switch third parser AT#STARTMODESCR=2 reboot and AT#QSS send 0,1

            I’m on third parser .



            I thinks so will be possible this :

            to gsm module save 6 script , 3x playscript -> play1.py , play2.py , play3.py and 3x record rec1.py … .

            I’m start with out of active script and on third parser instance .

            if MCU will receive request for call then define active script play1.phy , this script run on first parser instance. and then start call ATD>SM1; and script in cycle read of call status if see so I’m call to any number then open file with audio 1 and send to GSM (#SPCM) and cycle this audio . my MCU wait some defined time  and stop call ATH. then python script receive error (no call) or timeout and go to end and stop. no script is running . 

            and if want record then do it same but only define other script.  


            what happened if script start send data (#SPCM ) on first parser instance an my MCU on third parser send ATH. MCU receive released and script receive what???



          15. I would say, being a single GSM engine, a call can be controlled from all AT instances. Give it a try.

  2. Hi.

    If sample frequency is 8kHz then minimal UART speed is 8kHz * 10(bit per byte) = 80kBaud -> 115200 is minimal speed. or my formula is wrong???

     What happened if  I use slow speed???



    1. Your calculations are not correct, this is PCM stream not RS232 serial, should be sampled at specified rate.

      8 * 8000 * 1= 64Kbps

        1. OK I’ve got a note the stream is in fact RS232, so you must use a baudrate higher than 64,000 in order to not loose samples.


          1. but what happened if define UART speed 9600. then what?
            data are stored to internal ram (gsm module) and then in low speed send to UART or destroy any data …. .
            it’s will good if any one write more how to use this command.




  3. Hi. Is there any link where I can download python win for telit gsm module???
    I have some example code but don’t have basic installation for python win .


     I don’t have access to download zone. and Mr.Tomas Knapko from rutronik are sick (if need something then contact him.)




      1. I send request to Rutronik for direct access to download zone but all what I want the send my on email.


        I have it thanks.

        I don’t developing python script while don’t have new xx.xx.4 firmware on some module .

        On first I need test it self on my program ..




        PS: about #SPCM I contact  after new firmware obtain .