Announcement

Collapse
No announcement yet.

cgi.c and serial port

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • cgi.c and serial port

    Hi!
    I'm having some trouble with the cgi.c sample. I uploaded the program into the MatchPort Pro in order to download a picture from a system connected to the serial port 0.
    But this system works at a rate speed of 115200 bps, and apparently, the program seems to configure the serial port at 9600 bps (yet, the MatchPort is set at 115200 in the Web Manager). I've heard it may be related to the "TLOG".
    Here's the part of cgi.c that seems to cause trouble :

    Code:
    int SDKMain(struct command_line *commandLine, struct http_server *httpServer)
    {
    
        (void)commandLine;  /*Evite les warnings lors de la compilation*/
        (void)httpServer;   /*Evite les warnings lors de la compilation*/
    
        /*
        ** Initialize TLOG output for serial port 0.
        ** Ordinarily, the TLOG is not displayed on the console port. By calling
        ** this API, all TLOG entries are echoed on the console port in addition to
        ** logging them in memory.
        */
        TLogConsoleInit(0);
    
        /* Enable output of all severity levels */
        TLogConsoleEnable(TLOG_SEVERITY_ALL);
    
        TLOG(TLOG_SEVERITY_DEBUG, "Registering HTTP callback for sample." );
    
        /* Register callback with the HTTP server */
        if(! HttpDynamicCallbackAdd(httpServer, "/image", sampleWebMgrCallback))
        {
            TLOG(TLOG_SEVERITY_ERR, "Failed to register callback with HTTP Server.");
        }
    
        return 0;
    First, I'd like to know what TLOG is because I can't figure it out, and do you know how can I run the program at a speed of 115200 bps?

  • #2
    TLog is a debugging tool and bypasses the serial driver and will clash with serial writes your program will need to make. The serial driver write function (SerialWrite) is buffered, has flow control, etc. TLogConsoleInit() sets the baud rate to 9600 and access the UART registers directly. It can be overridden by setting the serial speed after TLogConsoleInit(), however I'd recommend configuring the tlog output to be to the other serial port, or set up a syslog server and view the output on a different computer.

    You can also view the tlogs from the network with the 'show tlog' and 'auto show tlog' commands in the enable | device level of the CLI. Just telnet to the device, navigate to the device level and issue the show tlog command. If you use auto show tlog, it will update the display every two seconds until a key is hit. You can also view the tlogs via a web browser by going the the /xyz URL. For example http://192.168.10.10/xyz will display the current TLog output.

    Syslog settings are set on the syslog page of the web manager.

    Comment

    Working...
    X