NBWIFIN and FTP
NBWIFIN and FTP
I got the NBWIFIN kit running with a MOD5445 using the WIFI Client example code. Everything was working fine, except that it doesn't find the connection in Debug mode. Then tried to set up an FTP server using code from the EFFS-FTP with files on a SD card. Here is what I get:
1. Loads WIFI, finds a connection and connects fine.
2. File system loads with no problem.
3. I can access the web page from either the WIFI url or the Ethernet url.
4a. I can FTP to the Ethernet url; it retrieves that directory, but it hangs with no trap (the counter freezes and it won't respond to HTTP or FTP requests.
4b. If I FTP to the WIFI url, it hangs as above with no response.
In the program, I set up WIFI first, FTP second and HTTP third. I tried them in different orders, but results were the same.
Any suggestions as to how to get FTP to work with the NBWIFIN would be appreciated.
It would also be nice to know how to use Debug with the NBWIFIN.
Thanks
Ed.
1. Loads WIFI, finds a connection and connects fine.
2. File system loads with no problem.
3. I can access the web page from either the WIFI url or the Ethernet url.
4a. I can FTP to the Ethernet url; it retrieves that directory, but it hangs with no trap (the counter freezes and it won't respond to HTTP or FTP requests.
4b. If I FTP to the WIFI url, it hangs as above with no response.
In the program, I set up WIFI first, FTP second and HTTP third. I tried them in different orders, but results were the same.
Any suggestions as to how to get FTP to work with the NBWIFIN would be appreciated.
It would also be nice to know how to use Debug with the NBWIFIN.
Thanks
Ed.
Re: NBWIFIN and FTP
I would try getting the simplest thing to work first. Until FTP is working with Ethernet (and no wifi), it probably won't work with both.
Re: NBWIFIN and FTP
Sorry for not indicating so, but I did test to ensure that everything worked on its own.
FTP works perfectly without the WIFI.
WIFI works until I FTP to either the Ethernet or WIFI.
Debug works, but the WIFI does not find Access Point and will not connect in Debug mode.
FTP works perfectly without the WIFI.
WIFI works until I FTP to either the Ethernet or WIFI.
Debug works, but the WIFI does not find Access Point and will not connect in Debug mode.
Re: NBWIFIN and FTP
Give me the FULL setup you are using. Are you running SPI or Serial for the wifi? What module are you using? If running SPI, is the SD card on the same SPI as the Wifi? If you're in the dev board this answer is "yes". Are you running with the SHARE_QSPI macro turned on in the Filesystem driver?
My bet is that you have bus contention going on with SPI and that's what's nuking the connection once you hit FTP.
This sounds like a problem best answered through support.
[Edit: If you're using a MOD5441X, which SD card are you using? Onboard or offboard?]
-Dan
My bet is that you have bus contention going on with SPI and that's what's nuking the connection once you hit FTP.
This sounds like a problem best answered through support.
[Edit: If you're using a MOD5441X, which SD card are you using? Onboard or offboard?]
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: NBWIFIN and FTP
Module is MOD54415 on the DEV board with the NBWIFIN kit.
Running NBWIFIN in SPI interface mode. Using IRQ3 i.e. pin J2[26].
SD card is in the DEV board slot.
I can't find any "SHARED_QSIP" macro, but upon looking , I see that I did not comment out the
I also noticed that the example code includes <qspi.h> rather than <dspi.h>. I am going to play around with those as well.
Thanks for the pointers.
Any ideas about the NBWIFIN not finding the AP when running in Debug? Is there some timing setting that should be tweaked?
Ed
Running NBWIFIN in SPI interface mode. Using IRQ3 i.e. pin J2[26].
SD card is in the DEV board slot.
I can't find any "SHARED_QSIP" macro, but upon looking , I see that I did not comment out the
line in the predef.h file. I will try that and report back.#define NB_ENABLE_USER_QSPI ( 1 )
I also noticed that the example code includes <qspi.h> rather than <dspi.h>. I am going to play around with those as well.
Thanks for the pointers.
Any ideas about the NBWIFIN not finding the AP when running in Debug? Is there some timing setting that should be tweaked?
Ed
Re: NBWIFIN and FTP
Now I have trouble!
I commented out the line in predef.h, ran Rebuild All System Files and then ran a Clean on the project.
It returned 18 errors. I then recommented the line in predef.h and ran Rebuild... and a Clean; still 18 errors.
From the errors and poking around in the system files, it looks like the /nburn/system/sdShared.cpp and /nburn/MOD5441X/system/mmc_mcf.cpp have conflicting definitions of some functions.
If I get rid of sdShared.cpp, I am left with 4 errors:
The definitions are in effs_fat/multi_drive_mmc_mcf.h, but are not compiled in mmc_mcf.cpp if the QSPI is shared; they are also in sdShared.cpp, but the parameters are (void) and don't match the definitions.
Unless someone has some insight, which I would really appreciate, I guess this is going to be a support ticket.
Ed
I commented out the line in predef.h, ran Rebuild All System Files and then ran a Clean on the project.
It returned 18 errors. I then recommented the line in predef.h and ran Rebuild... and a Clean; still 18 errors.
From the errors and poking around in the system files, it looks like the /nburn/system/sdShared.cpp and /nburn/MOD5441X/system/mmc_mcf.cpp have conflicting definitions of some functions.
If I get rid of sdShared.cpp, I am left with 4 errors:
Code: Select all
Description Resource Path Location Type
undefined reference to `spi_get_baudrate' WIFI_TEST1 line 699, external location: C:\nburn\MOD5441X\system\mmc.c C/C++ Problem
undefined reference to `spi_init' WIFI_TEST1 line 1000, external location: C:\nburn\MOD5441X\system\mmc.c C/C++ Problem
undefined reference to `spi_set_baudrate' WIFI_TEST1 line 698, external location: C:\nburn\MOD5441X\system\mmc.c C/C++ Problem
undefined reference to `spi_set_baudrate' WIFI_TEST1 line 748, external location: C:\nburn\MOD5441X\system\mmc.c C/C++ Problem
The definitions are in effs_fat/multi_drive_mmc_mcf.h, but are not compiled in mmc_mcf.cpp if the QSPI is shared; they are also in sdShared.cpp, but the parameters are (void) and don't match the definitions.
Unless someone has some insight, which I would really appreciate, I guess this is going to be a support ticket.
Ed
Re: NBWIFIN and FTP
Sorry about this, but long story short... you can't use the Wifi dev board with the offboard SD card and a MOD5441X. The MOD5441X MMC driver cannot share the SPI bus as it does not actually make use of the DSPI driver. You'll need to use the onboard SD card for development, at least until you spin a prototype. In the event that you still wish to use the offboard SD card, you will need to have the wifi on a separate SPI bus from the SD card.
Note: It is much easier to move the Wifi to a different bus (aka, away from SPI 1) than the SD card.
-Dan
Note: It is much easier to move the Wifi to a different bus (aka, away from SPI 1) than the SD card.
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: NBWIFIN and FTP
Thanks Dan. I got it working with the on-board microSD.
I put the FileSystemUtils files from the \examples\MOD5441X\\examples\MOD5441X\EFFS-MULTIPLE-MMC example into the \examples\StandardStack\EFFS\EFFS-FTP example. I had to change the function calls to start the file system, which is fairly obvious, but I also has to change #define MMC_ON_BOARD (1) to #define MMC_ON_BOARD (2) in FileSystemUtils.cpp so that the drive number matches the #define MMC_DRV_NUM 2 in fat.h which is used in ftp_f.cpp to determine which drive to use for the FTP session.
Ed
I put the FileSystemUtils files from the \examples\MOD5441X\\examples\MOD5441X\EFFS-MULTIPLE-MMC example into the \examples\StandardStack\EFFS\EFFS-FTP example. I had to change the function calls to start the file system, which is fairly obvious, but I also has to change #define MMC_ON_BOARD (1) to #define MMC_ON_BOARD (2) in FileSystemUtils.cpp so that the drive number matches the #define MMC_DRV_NUM 2 in fat.h which is used in ftp_f.cpp to determine which drive to use for the FTP session.
Ed
Re: NBWIFIN and FTP
Ed - I've tried to reproduce your FTP example with the 54415 on board micro SD card, and got the writing . reading to the SD card AND FTP to / from the contents of the on board SD card working by changing #define MMC_ON_BOARD (1) to #define MMC_ON_BOARD (2) in FileSystemUtils.cpp (as you say).
BUT on boot the system fails with the Card Detect error if there's not an SD card plugged into the Dev Board SD slot. (Yes DEV board full size SD card, even though we're going to use the on board micto SD for FTP'ing the files). The error message is:
"No on-board MMC/SD card detected. Insert a card and then press <Enter>" (as you would expect from the code below if the SD card was missing).
So the card detect logic is still using the Dev board full size SD card slot, not the micro SD card on the module.
I assume this is caused by the code in function int OpenMMCFlash(int drv) in FileSystemUtils.cpp
The get_cd(drv) must be returning zero? (drv will be set to 2 for the On-board SD Card) ...
So it seems setting the drive to 2 doesn't switch the get_cd function result to be from the correct SD Card ...
Any ideas?
BUT on boot the system fails with the Card Detect error if there's not an SD card plugged into the Dev Board SD slot. (Yes DEV board full size SD card, even though we're going to use the on board micto SD for FTP'ing the files). The error message is:
"No on-board MMC/SD card detected. Insert a card and then press <Enter>" (as you would expect from the code below if the SD card was missing).
So the card detect logic is still using the Dev board full size SD card slot, not the micro SD card on the module.
I assume this is caused by the code in function int OpenMMCFlash(int drv) in FileSystemUtils.cpp
The get_cd(drv) must be returning zero? (drv will be set to 2 for the On-board SD Card) ...
Code: Select all
int OpenMMCFlash(int drv)
{
// Card detection check
if (get_cd(drv) == 0) {
while (get_cd(drv) == 0) {
if (drv == MMC_OFF_BOARD)
iprintf("No off-board MMC/SD card detected. Insert a card and then press ");
else
iprintf("No on-board MMC/SD card detected. Insert a card and then press ");
iprintf("<Enter>\r\n");
if (getchar() == 13) break;
}
}
Any ideas?
Gavin Murray
Re: NBWIFIN and FTP
Hi Gavin,
I did find that problem and added the following code just after the #define MMC_ON_BOARD (2):
then I changed the function:
Ed
I did find that problem and added the following code just after the #define MMC_ON_BOARD (2):
Code: Select all
#define chkdrv (drv == MMC_ON_BOARD)?1:drv // Need this to check for get_cd and get_wp which use the base drv definitions prior to mounting
Code: Select all
int OpenMMCFlash(int drv)
{
// Card detection check
if (get_cd(chkdrv) == 0) {
while (get_cd(chkdrv) == 0) {
if (drv == MMC_OFF_BOARD)
iprintf("No off-board MMC/SD card detected. Insert a card and then press ");
else
iprintf("No on-board MMC/SD card detected. Insert a card and then press ");
iprintf("<Enter>\r\n");
if (getchar() == 13) break;
}
}
// Write protection check
if (get_wp(chkdrv) == 1) {
while (get_wp(chkdrv) == 1) {
iprintf("SD/MMC Card is write-protected. Disable write protection, then ");
iprintf("press <Enter>\r\n" );
if (getchar() == 13) break;
}
}
int rv;
if (drv == MMC_OFF_BOARD) rv = f_mountfat(drv, mmc_initfunc, F_MMC_DRIVE0);
else if (drv == MMC_ON_BOARD) rv = f_mountfat(drv, mmc_initfunc, F_MMC_DRIVE1);
else rv = F_ERR_INVALIDDRIVE;
if (rv == F_NO_ERROR) iprintf( "FAT mount to %s successful\r\n", driveType);
else {
iprintf("FAT mount to %s failed: ", driveType);
DisplayEffsErrorCode(rv);
return -1;
}
return drv;