This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[DM6437] Problem with UART Example

I run the  UART Example fine, but when I try to write multiple times it doesn't work.

 

I add the blue line code.

 

static void genericUartTest()

{

    PSP_uartDataParam buf;

    Int status   =  0;

    size_t len   =  0;

    Int8   *str  =  NULL;

 

    str = "UART Demo Starts:  INPUT a file of size 1000 bytes";

 

    // Copy to start string to Cache aligned buffer

    strcpy(uartTestStringStart,str);

 

    // Input buffer

    buf.addr = uartTestStringStart;

 

    // Time out value

    buf.timeout = SYS_FOREVER;

 

    // Length of data

    len = strlen(uartTestStringStart);

 

    status = GIO_submit(hUart_OUT,IOM_WRITE, &buf, &len, NULL);   // I can see the "UART Demo Starts:  INPUT a file of size 1000 bytes" message on PC device

    status = GIO_submit(hUart_OUT,IOM_WRITE,&buf,&len,NULL);      // Write one more time, but nothing send out?

 

    ...

 

 

 

  • Is there anyone who can give me some suggestion?

  • If you set a breakpoint on the second Submit, are the values of buf and len correct?

  • yes, they are correct just not sending out.

    buf point to string "UART Demo Starts:  INPUT a file of size 1000 bytes"

    and

    len = 50

     

    RandyP said:

    If you set a breakpoint on the second Submit, are the values of buf and len correct?

     

  • In the BIOS API Reference Guide, the example for GIO_Submit shows the size parameter being reinitialized even though it is to the same value. This implied to me that the first call might change this value. That is why I asked about the values before the second call.

    Does the second one run differently when you set the breakpoint and then run after a long physical delay?

    As a debug technique, I recommend reinitializing both parameters and also inserting a very long delay between the two calls to GIO_Submit.

    What is the status return value after the first one and after the second one?

    What are the bufp and len values after the second call?

    Regards,
    RandyP

  • Thanks for your reply, RandyP.

    I added blue line codes following your advice to the example, still doesn't solve the problem.

    The bufp and len values remain the same in the process even after the second call.

    Both first and second status return 0.

     

        // ===================================================

        str = "UART Demo Starts:  INPUT a file of size 1000 bytes";

        // Copy to start string to Cache aligned buffer

        strcpy(uartTestStringStart,str);

     

        // Input buffer

        buf.addr = uartTestStringStart;

        // Time out value

        buf.timeout = SYS_FOREVER;

        // Length of data

        len = strlen(uartTestStringStart);

     

        status = GIO_submit(hUart_OUT,IOM_WRITE, &buf, &len, NULL);  

        // status = 0

        TSK_sleep(2000u);    /* Add large delay */

        // reinitializing Input buffer

        buf.addr = uartTestStringStart;

        // reinitializing Time out value

        buf.timeout = SYS_FOREVER;

        // reinitializing  Length of data

        len = strlen(uartTestStringStart);

        status = GIO_submit(hUart_OUT,IOM_WRITE,&buf,&len,NULL);

       // status = 0

       // ======================================================

     

    RandyP said:

    In the BIOS API Reference Guide, the example for GIO_Submit shows the size parameter being reinitialized even though it is to the same value. This implied to me that the first call might change this value. That is why I asked about the values before the second call.

    Does the second one run differently when you set the breakpoint and then run after a long physical delay?

    As a debug technique, I recommend reinitializing both parameters and also inserting a very long delay between the two calls to GIO_Submit.

    What is the status return value after the first one and after the second one?

    What are the bufp and len values after the second call?

    Regards,
    RandyP

     

  • Hi, RandyP.

    Any other suggestion?

  • Perhaps the BIOS forum can provide some answers. I do not have more suggestions.

    Regards,
    RandyP

  • I found something interesting.

    When I set baud rate to 9600, it works fine! 

    And there is no need to reinitialized the parameters at all.

    115200 can't work properly.

    So I'm using 9600 now.