Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

getc() and 0x00 bytes

Altera_Forum
Honored Contributor II
951 Views

Hi, 

 

I am having a problem reading data from an UART core. The incoming data should look like 

 

0A 00 00 00 D6 00 0D 

 

but using getc(fp) or fgetc(fp) I only get the NOT_ZERO bytes 

 

0A D6 0D 

 

This is my function: 

 

INT8U prompt = 0; INT8U i = 0; FILE* fp; fp= fopen(UART_BU_NAME, "r"); if (fp == NULL) { fprintf(stderr, "open failed\n"); return; } i = 0; while(prompt = fgetc(fp)){ i++; printf("0x:%02X",prompt); } printf("\n\rCounted %d characters\n\r", i); //returns value 3 (instead of 7)  

 

Am I using the wrong function? Since it only happens with 0 bytes, I tend to believe it has nothing to do with overflows/task priority, but only with the way how the data is interpreted. 

 

==== LE ===== 

 

With SignalTap I was able to see a read request on AvalonMM bus from the RXDATA register with value 0x00...
0 Kudos
0 Replies
Reply