Menu

two serial captured Data out of sync

Anonymous
2022-07-05
2022-07-06
  • Anonymous

    Anonymous - 2022-07-05

    Hello

    i used the example script (MultiSerial)to capture the communication data between MCU with NBIoT modem .
    The MCU send AT command to Modem ,then modem will reponse .
    i added the time stamp of the example script. shows as below.

    var portSaved=800; //What i added
    function addConsoleData()
    {
    var consoleString;
    var serialPortsIndex = g_consoleData[g_consoleData.length-1][2];

    if(g_consoleData[g_consoleData.length-1][1] ) //received
    {
        consoleString = "<span style=\"color:" + getPortColorHTML(serialPortsIndex) + ";\">";
    }
    else
    {
        consoleString = "<span style=\"color:" + getPortSentColorHTML(serialPortsIndex) + ";\">" ;
    }
    
    if(UI_ShowAscii.isChecked())
    
    {
        if(portSaved !=serialPortsIndex) //what i added code
        {
            consoleString +="["+scriptThread.getTimestamp(scriptThread.getTimestamp("yyyy-MM-dd hh:mm:ss.zzz"))+"]"+"\r\n";
            portSaved=serialPortsIndex;
        }
    
        consoleString += UI_TextEdit.replaceNonHtmlChars(scriptThread.byteArrayToString(g_consoleData[g_consoleData.length-1][0]).replace(/\r\n/g, "\n")) ;
    
    }
    

    the captured data seems not as i want.
    in my view ,the caputred data should show as:
    MCU send first AT command
    Modem reponse of the firt command
    MCU send second AT command
    Modem reponse of the second command
    MCU send third AT command
    Modem reponse of the third command

    but what acutal shows as below captured data. i think this is because the thread delay, didn't print the received data quickly.
    So how can i improve it .
    Captured data

    [2022-07-05 03:41:21.521] AT+CFUN=0 //MCU send first AT command
    [2022-07-05 03:41:23.490] [2022-07-05 03:41:23.490] AT+CFUN=0//Send second AT command
    [2022-07-05 03:41:23.505]
    ERROR //Modem reponse of first command
    [2022-07-05 03:41:25.458] AT+CFUN=0//Mcu send third AT command
    [2022-07-05 03:41:25.458]
    ERROR //Modem reponse of sencond command

    OK //Modem reponse of third command

    Thanks in advance
    regards
    Denson.li

     
  • Stefan Zieker

    Stefan Zieker - 2022-07-05

    Hi,

    is ScriptCommunicator in the middle of the connection (does ScriptCommunicator routes the data)? If so then maybe this script can help:
    https://sourceforge.net/projects/routeserialtcpudp/

    Regards.
    Stefan

     
  • Anonymous

    Anonymous - 2022-07-06

    Hello Stefan

    No ,thanks.
    i use two USB-TTL device 's Rx connect to the wire between the microcontroller with the radio(modem). So #1 USB-TTL RX pin will receive the MCU send out data , and #2 USB-TTL device RX pin will recieve the Modem send out data .
    The MCU sends out AT command ,
    The Modem sends out the response of the AT command .
    So both USB-TTL Rx Seem like sniffer.
    i use them to check whether the communication is correct or not.
    So I use the example "MultiSerial " script to open two ports, both just receive the data .
    i add the time stamp code ,but the received data displays not as want.
    This is not critical problem.

    Regards
    Denson.li

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.