cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sistdig
Visitor
Visitor
4,600 Views
Registered: ‎04-21-2008

Writing data on CF card using EDK 10.1 and xilfatfs

Hi there,

I'm making a kind of sniffer for a small network with very low traffic. I need to capture the traffic and store the packets in a permanent storage medium. At this time I'm using the ML403 board from Xilinx, EDK 10.1 and the xilfats library.

As a preliminary test, I'm sending controlled individuals packets, and the device receive the packet and save it in a file into the CF card. This works for a time but the application crash after some time.

With the xilfatfs library, I open a file, and at the reception of a packet I write the content and close the file. This step is repeated for every packet. I'm using a 64 K BRAM memory for the system. Using the defaults options for the linker script, the system hangs after receiving 15 packets (15 files). Increasing the stack size allows to handle more files but the system always hangs. Increasing too much the stack size is not a valid option, because in practice I need the system being able to handle large amount of data.

Also, saving more packets in a single file allows to manage more information. For example, in this case I can save a total of 60 KB of data instead of 15 KB with small files before the system hangs. But in any case, this is far for the limits imposed for the FAT16 file-system, which is used in the CF card.

In summary, I save the data in a temporal array which have fixed size, at the end I write the content of the array in a file and close the file. So, my question is: If I'm using a fixed amount of memory for the temporal data, and just one file open at any time, why the system go out of memory?

I'm new on the embedded applications and I don't manage all the concepts about memory maps, linkers, etc. So I'm generally using the default options from the tools. I don't know if I 'm doing something wrong or there are some conceptual misconceptions. But I have been reading and trying a lot of hours without success.

Any clue would be really appreciated.

Cheers!
0 Kudos
Reply
2 Replies
edk_dingle
Observer
Observer
4,571 Views
Registered: ‎08-02-2007

I am not sure exactly why your specific sw application is running out of memory. However, there are a few example designs that you can use to get an idea of how the drivers should be setup (maybe you have already seen them, but if not, they are listed below).

 

For the ML506 board reference designs click on the ml506_bsb_std_ip.zip link at - http://www.xilinx.com/products/boards/ml506/bsb.htm. Once you have downloaded and unzipped this file, you should be able to navigate to the ml506_std_ip_pcores\sw\standalone\testfatfs\src directory. The source code in this example should be a good starting point for setting up your specific sw application.

 

Even though the above targets the ml506 board, you should be able to get a good idea of how Xilinx has run some small tests using the xilfatfs drivers.

0 Kudos
Reply
sistdig
Visitor
Visitor
4,566 Views
Registered: ‎04-21-2008

Thanks a lot.

The code is pretty much close to what I'm doing. The main difference is that I'm repeating the same process a lot of times.

Based on the opinions on some forums, I think that it is a stack size problem, which is consistent with the fact that increasing the stack size, allows to manage more files (but hanging anyway later). But, if I'm managing just one file open at time, my educated guess is that the sysace_fclose() command it's not freeing the memory used for that file.

 

I'm still trying to make it works (same problem), any sugestion would be very helpful and appreciated.

 

Cheers

0 Kudos
Reply