rasty1 wrote on Sunday, July 17, 2016:
I had to add 2 defines, otherwise it would not compile.
#define ffconfigDEV_PATH “/”
#define ffconfigDEV_SUPPORT 1
Still the same problems
rasty1 wrote on Sunday, July 17, 2016:
I had to add 2 defines, otherwise it would not compile.
#define ffconfigDEV_PATH “/”
#define ffconfigDEV_SUPPORT 1
Still the same problems
rasty1 wrote on Sunday, July 17, 2016:
I’m afraid there is some basic problem with file system (please scroll to the end):
char test_str[]=“Hello ------------------------------- word\n\r”;
/* Create the RAM disk. */
pxRAMDisk = FF_RAMDiskInit( mainRAM_DISK_NAME, ucRAMDisk, mainRAM_DISK_SECTORS, mainIO_MANAGER_CACHE_SIZE );
configASSERT( pxRAMDisk );
/* Print out information on the RAM disk. */
stat = FF_RAMDiskShowPartition( pxRAMDisk );
pxFile = ff_fopen( "test.txt", "w" );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
ff_fclose( pxFile );
File looks like:
–>type test.txt
Hello ------------------------------- word
------------------------------- word
--------------------------- word
---------------------- word
----------------- word
------------ word
------- word
– word
rd
Hello ------------------------------- word
------------------------------- word
--------------------------- word
---------------------- word
----------------- word
------------ word
------- word
– word
rd
Hello ------------------------------- word
heinbali01 wrote on Sunday, July 17, 2016:
Thanks, that was the difference between your and my project. Now it is reproducible for me. I’ll have a detailed look at it.
Regards, Hein
heinbali01 wrote on Sunday, July 17, 2016:
You can either exclude ff_dev_support.c from your project and define:
#define ffconfigDEV_SUPPORT    0
… or you can define the following:
#define ffconfigDEV_SUPPORT    1
#define ffconfigDEV_PATH       "/dev"
The module was included in the +FAT distribution, but not yet documented. At this moment, the code is only a sketch. The idea is to open a virtual file and talk with a device ( just like e.g. /dev/ttyS0 under Linux ).
heinbali01 wrote on Sunday, July 17, 2016:
char test_str=“Hello ------------------------------- word\n\r”;
ff_fwrite( test_str, sizeof(test_str), 1, pxFile );
Could you try the same test but without adding the terminating zero of the strings, like this:
ff_fwrite( test_str, sizeof(test_str) + 1, 1, pxFile );
Adding zeros is a bit confusing
heinbali01 wrote on Sunday, July 17, 2016:
Sorry, not +1 but -1 byte of course:
    -ff_fwrite( test_str, sizeof(test_str) + 1, 1, pxFile );
    +ff_fwrite( test_str, sizeof(test_str) - 1, 1, pxFile );
heinbali01 wrote on Sunday, July 17, 2016:
Sorry, not +1 but -1 byte of course:
    -ff_fwrite( test_str, sizeof(test_str) + 1, 1, pxFile );
    +ff_fwrite( test_str, sizeof(test_str) - 1, 1, pxFile );
rasty1 wrote on Monday, July 18, 2016:
do you means “sizeof(test_str) - 1”?
I’d expect some garbage at the end of the line.
I did this test because my logs that I print to file also look incomplete.
rasty1 wrote on Monday, July 18, 2016:
ff_fwrite( test_str, sizeof(test_str)-1, 1, pxFile );
–>type test.txt
Hello ------------------------------- word
Hello
------------------------------- word
Hello ------
------------------------- word
Hello ------------
------------------- word
Hello ------------------
------------- word
Hello ------------------------
------- word
Hello ------------------------------
Hello ------------------------------- word
Hell
o ------------------------------- word
Hello ----
--------------------------- word
Hello ----------
--------------------- word
Hello ----------------
--------------- word
Hello ----------------------
--------- word
Hello ----------------------------
— word
Hello ------------------------------- wo
rd
Hello ------------------------------- word
He
llo ------------------------------- word
Hello –
----------------------------- word
Hello --------
----------------------- word
Hello --------------
----------------- word
heinbali01 wrote on Monday, July 18, 2016:
Right, that is what is expected.
I did this test because my logs that I print to file also look incomplete.
Have you found out why?
rasty1 wrote on Monday, July 18, 2016:
I found the problem with typing file!
unnessesary “strcat( pcWriteBuffer, cliNEW_LINE )” in prvTYPECommand inserts cr-lf every 50 chars.
Now my logs look great! And I approach to the real problem. FTP and HTTP do not work.
rasty1 wrote on Monday, July 18, 2016:
Short summary.
Thank you very much dor the help.
heinbali01 wrote on Monday, July 18, 2016:
What ‘patch’ are you referring to?
Do you mean this:
    You can either exclude ff_dev_support.c from your project and define:
    #define ffconfigDEV_SUPPORT    0
That should help for the problem that you reported as:
    -->type //test.txt
And this should also solve it:
#define ffconfigDEV_SUPPORT    1
#define ffconfigDEV_PATH       "/dev"
The mentioned defines must appear in your FreeRTOSFATConfig.h.
In your case, when ffconfigDEV_PATH is an empty string, the string “//test.txt” refers to a device and not a file.
A size of 2048 bytes is returned for a device and in your case “//test.txt”  is still interpreted as a divice.
By the way, there is an easy way of sending out logging:
FreeRTOS-Plus/Demo/Common/Utilities/UDPLoggingPrintf.c
It has some buffering of the logging lines and it also precedes each line with a millisecond-time-stamp, such as:
2016-07-18 23:43:12.896 IP Address: 192.168.2.1
It is easy to add TCP logging to this module. I normally connect it to a telnet server.
lUDPLoggingPrintf is not interrupt-proof 
    strcat( pcWriteBuffer, cliNEW_LINE )
Some telnet clients like this, because only complete lines (with a LF) will be flushed.
For others (also for me), the extra LF can be confusing.
In UDPLoggingPrintf.c, no LF’s will be added. Also it has an option to turn every LF into a LF/CR:
    #define configUDP_LOGGING_NEEDS_CR_LF    1
“hello world\n” will be then sent as “hello world\r\n”
Regards.