Hi Wally, 

I have tried adding fflush(stdout and fflush(stderr) in the while loop, 
however, in the UartRxWait thread, the read( ) function is in block waiting 
for incoming data. Which doesn't output anything. In the case, after start 
and shut down minicom, the UartRxWait thread running as usual, there is no 
output from the fflush(stdout) and fflush(stderr) either. 

yes, at the moment I have to kill the program to terminate.  I have 
modified the code such that it loop for only 5 times and terminate the 
thread. 

// UART RX thread
void* uartRxWait(void *param){

    unsigned char receive[100];
    int count;
    static int n;

     while(n<5){
            if ((count = read(file, (void *)receive, 100))<0)
            {
                perror("Failed to read from input \n");
                printf("count = %d\n", count);
            }else{

                if(receive[2]==0x32){
                    printf("Header received \n");    
                }
                    printf("Byte received [%d] \n", count);
                    printf("Value of Pi = 0x%.2x\n", receive[0]);
            }
            n++;
            fflush(stdout);
            fflush(stderr);
    }

    pthread_exit(0);
}


One thing I observed is that, my regular file write is able to write 
something: I don't understand why? 

    fdata = fopen("capture.dat", "w");
    if (fdata == NULL) {
            printf("I couldn't open capture.dat for writing.\n");
            exit(0);
    }
    // save in file 
    fprintf(fdata, "%s", "test");


Yes, I send the command before launching the thread to receive the reply. I 
thought it doesn't matter as the receive byte will be stored in buffer.  
Anyway, I tried placing the sending command after receive thread, but the 
problem still exist.  





 
   

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/c7412d4c-3dd6-49d8-9363-b99635a1559b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to