Added patterns to check TFTP received data. All woks good now.

master
maxxir_w 7 years ago
parent 4e2862981a
commit e1acb98737

@ -11,10 +11,10 @@
* TODO:
* OK(v1.1) 1. Print-out received file from TFTP to serial console (small file < 512 bytes OK).
* OK(v1.2) 2. Print-out received file from TFTP to serial console (multi-packet files > 512 bytes).
* OK(v1.3) 3. Write-in data to SD-card file "readme_txt" and another patterns.
* 4. Print out "readme.txt" contents head (from SD-Card ) in a serial terminal.
* OK(v1.3) 3. Write-in data to SD-card file "test.txt" and another patterns.
* OK(v1.4) 4. Print out "test.txt" contents head (from SD-Card ) in a serial terminal.
* 5. Add handlers for CHK_RAM_LEAKAGE && CHK_UPTIME.
* 6. Clear the code from the loopback sockets
* 6.?? Clear the code from the loopback sockets (Is it really need to do?)
*
* Remark:
* Checked with PC tftp-server (WIN7) - tftpd64.exe
@ -63,7 +63,7 @@ volatile unsigned long _millis; // for millis tick !! Overflow every ~49.7 days
//*********Program metrics
const char compile_date[] PROGMEM = __DATE__; // Mmm dd yyyy - Дата компиляции
const char compile_time[] PROGMEM = __TIME__; // hh:mm:ss - Время компиляции
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.3 Static IP TFTP Client && FATFS SDCARD WIZNET_5500 ETHERNET 27/03/2019\r\n"; // Program name
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.4 Static IP TFTP Client && FATFS SDCARD WIZNET_5500 ETHERNET 28/03/2019\r\n"; // Program name
#if defined(__AVR_ATmega128__)
const char PROGMEM str_mcu[] = "ATmega128"; //CPU is m128
@ -373,7 +373,7 @@ void fatfs_head_file(const char * fn)
_buf[br] = 0x0;
else
_buf[127] = 0x0;
PRINTF ("OK\r\n");
PRINTF("OK\r\n");
PRINTF("text contents reading %u bytes:\r\n", br);
PRINTF("%s", _buf);
}
@ -391,6 +391,7 @@ void fatfs_head_file(const char * fn)
PRINTF ("ERROR opening file <%s> ", fn);
put_rc(f_err_code);
}
PRINTF("\r\n");
}
void fatfs_init(void)
@ -520,7 +521,7 @@ int main()
//FAT_FS init and quick test(root directory list && print out head index.htm)
fatfs_init();
fatfs_head_file("index.htm");
//fatfs_head_file("index.htm");
//Wizchip WIZ5500 Ethernet initialize
IO_LIBRARY_Init(); //After that ping must working
@ -557,10 +558,10 @@ int main()
printf("\r\n########## SW1 was pressed.\r\n");
memset(tftp_filename, 0x0, TFTP_FILE_NAME_SIZE);
//!!Don't forget about 8.3 file name rule!!
//strncpy(tftp_filename, "test.txt", TFTP_FILE_NAME_SIZE);
strncpy(tftp_filename, "README.md", TFTP_FILE_NAME_SIZE);
strncpy(tftp_filename, "test.txt", TFTP_FILE_NAME_SIZE);
//strncpy(tftp_filename, "README.md", TFTP_FILE_NAME_SIZE);
//strncpy(tftp_filename, "tftpd32.ini", TFTP_FILE_NAME_SIZE);
//strncpy(tftp_filename, "ff_lfn.c", TFTP_FILE_NAME_SIZE);
//strncpy(tftp_filename, "ff_lfn.txt", TFTP_FILE_NAME_SIZE);
tftp_server = ((uint32_t)tftp_destip[0] << 24) | ((uint32_t)tftp_destip[1] << 16) | ((uint32_t)tftp_destip[2] << 8) | ((uint32_t)tftp_destip[3]);
@ -582,6 +583,10 @@ int main()
if(_ret == TFTP_SUCCESS)
{
PRINTF("\r\n++TFTP transfer complete:[%u] SUCCESS, received %lu bytes\r\n", _ret, get_tftp_received_size());
//Print-out head received file
fatfs_head_file(tftp_filename);
}
else if(_ret == TFTP_FAIL)
{

File diff suppressed because it is too large Load Diff

@ -0,0 +1,6 @@
#1 Hello to TFTP server!
#2 Hello to TFTP server again!
#3 It works!
#4 New string for test..
#5 Bumped :))

@ -0,0 +1,40 @@
[DHCP]
Lease_NumLeases=0
[TFTPD32]
BaseDirectory=.
TftpPort=69
Hide=0
WinSize=0
Negociate=1
PXECompatibility=0
DirText=1
ShowProgressBar=1
Timeout=3
MaxRetransmit=6
SecurityLevel=1
UnixStrings=1
Beep=0
VirtualRoot=0
MD5=0
LocalIP=
Services=1
TftpLogFile=
SaveSyslogFile=
PipeSyslogMsg=0
LowestUDPPort=0
HighestUDPPort=0
MulticastPort=0
MulticastAddress=
PersistantLeases=1
DHCP Ping=1
DHCP LocalIP=
Max Simultaneous Transfers=100
UseEventLog=0
Console Password=tftpd32
Support for port Option=0
UseEventLog=0
Keep transfer Gui=5
Ignore ack for last TFTP packet=0
Enable IPv6=0
UnicastBOOTP=0
DHCP Double Answer=0