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.

RTOS/TM4C129XNCZAD: HTTP server download issue

Part Number: TM4C129XNCZAD

Tool/software: TI-RTOS

All.

I've a strange issue regarding the downloading of a file over http protocol.

I set up a http server over my board, in order to export internal files, that are stored into a flash filesystem, to a local pc.

The stored file is correct (I've also a such kind of export via USB protocol and all is fine).

The issue observed consist of a wrong nibble in a random place, e.g.:

- the right nibble should be 0001 or 0010 or 0100 but on the file the nibble becomes 1001 or 1010 or 1100.

Such error is always located in the first nibble and bit #4.

The piece of code used to download file is the following:

----------------------------------------------------

Begin of C code

---------------------------------------------------

totalBytesCopied = 0;

bytesRead = APPDATA_GENERIC_BUFFER_SIZE;

byteSize = htmlFilesize;

httpSendStatusLine(htmlSock, HTTP_OK, CONTENT_TYPE_APPLET ); /* Send the HTTP status line */

sprintf( httpBuffer, "Content-Disposition: attachment; filename=%s;\r\n", &filename[1] );

httpSendClientStr( htmlSock, httpBuffer );

httpSendClientStr( htmlSock, "Accept-Ranges: bytes\r\n");

sprintf( httpBuffer, "Content-Length: %d\r\n\r\n", htmlFilesize );

httpSendClientStr( htmlSock, httpBuffer );

while( TRUE )

{

if( byteSize == 0 ) break;

if( byteSize < bytesRead ) { bytesRead = byteSize; }

 memcpy( appDataGenc.buffer, (unsigned char*)(fatFSBuffer + totalBytesCopied), bytesRead );

totalBytesCopied += bytesRead;

 ret = send( htmlSock, (char*)appDataGenc.buffer, bytesRead, 0 );

if( ret == -1 ) { OS_Error( "send socket error (-1)" ); break; }

if( ret < bytesRead ) { OS_Error( "send socket error bytes" ); break; }

byteSize -= bytesRead;

}

----------------------------------------------------

End of C code

---------------------------------------------------

Now I'm going to do some more test, but I would appreciate if there are any suggestion regarding this issue.

Regards,

Marco Crivellari

  • Hi Marco,
    Does the data in the buffer fatFSBuffer match the file contents? What version of TI-RTOS are you using?
    Thanks,
    Janet
  • Hi Janet.


    I'm using TI-RTOS 1.21.00.09





    Yes, the fatFSBuffer match the content, it was the first check I've done.


    Another consideration is that fatFSBuffer is located into SDRAM in a portion that start at address 0x10000000.

    In fact the correct code I'm using is the following:

    bytesWritten = 0;
    while( bytesWritten < bytesRead )
    {
    appDataGenc.buffer[bytesWritten] = EPIWorkaroundByteRead( (unsigned char*)(fatFSBuffer + totalBytesCopied) );
    bytesWritten++;
    totalBytesCopied++;
    }

    I've done a test like:

    appDataGenc.buffer[bytesWritten] = 'i';


    and I've no observed strange behaviour on nibble. I'm going to think that something is wrong on reading process from SDRAM.





    Thanks


    MC
  • Hi Marco,

    We're not sure what the problem is here, but somethings you could try are:

    • Running the app on a different board.
    • Run a memory test on the SDRAM.  There are several you can try such as 'walking 1', 'walking 0', 'A5A5', and '5A5A'.  You can find these on Google.

    Best regards,

    Janet

  • Hi Janet,
    I've done tests on three different board.

    All of them suffer of such issue. In order to get more information I've done different tests.

    I've done SDRAM tests with different pattern and with different type of access (32/16//8 bits). The SDRAM is ok.

    I've done similar test on socket using pattern and no issue again.

    The matter rise when the system read from SDRAM and put data into socket.

    I've collected a large amount of data (for statistics purpose) and the error is always focused on bit 4 of a random byte, and always I find 0 instead of 1.

    I'm wondering if such issue could be related to a particular data path of PCB.

    Regards,
    Marco
  • Hi Marco,

    Is this your own board or a TI board?  This sounds more like a hardware issue than a TI-RTOS issue.  We can move this post to device forum if you want.  They might have more insight into this problem.

    Best regards,

    Janet

  • Hi Janet,
    if you consider this issue related to device, let's move this discussion to device.

    Can you this for me?

    Regards,
    Marco