[moved] Read, Write using file demo example code for lpc4357 in keil version5

Status
Not open for further replies.

MD_SHAHRUKH

Advanced Member level 4
Joined
Jun 5, 2017
Messages
103
Helped
4
Reputation
8
Reaction score
5
Trophy points
1,298
Location
Bangalore, India
Visit site
Activity points
2,388
Hello everyone,

I am trying to program lpc4357 for filesystem management. I am using mcb4300 development board for programming. And I am using drivers provided by keil. When used the example code for microSD card it is working fine. when I am changing the configuration for NOR memory, the filesystem APIs like 'fopen' 'fread' 'fwrite' are not working. The driver I am using is for N25Q032A for a SPI based NOR memory. I am able read or write byte separately to that memory when directly accessing the driver, but filesystem APIs are not working.

NOR memory datasheet : N25Q032A
LPC4357 User Manual: LPC4357 UM
Steps following for interfacing: File System


Please, suggest if more detail required. I have attached the project file, but I think there are many dependency files which directly attached by keil packs when project is created.

Thank you.
 

Attachments

  • File_Demo.rar
    484.3 KB · Views: 198
  • FileSystem.rar
    1.5 MB · Views: 183
  • N25Q032A.rar
    4.4 KB · Views: 197
Yes, the return values of the function are given bellow as an example

C:
FILE *myfile;

myfile = fopen("xyz.txt","w");

Here the myfile is giving NULL.

And while I am not able to open any file, it going to Hard fault while using read or write instruction.

When I use mkdir to create a directory, I get a return value which implies the operation is not supported.
 

Once you have the whole source code of the API and since the LPC4357 supports JTAG debugging, I would go deep into the inner function(s) that is called by fopen and take their return codes. I see no shortcut to find the root cause of the problem that not diving and printing out the result of each function comparing expected and actual results.
 

I agree, but the problem is I cannot dig inside the fopen or any other file APIs, I think Keil itself is restricting the action. I can only get the return code. And also have no idea how these file APIs are pointing to the drivers. The File configuration file itself doesn't provide sufficient information as it comes with direct sections using the configuration wizard facility of Keil.

Can you tell me where I can learn these file management APIs, linking to the driver? Also, how do I understand these standard libraries linking to the low-level drivers? As I was able to read- write directly to the memory, but it has become more like an EEPROM.

Let me know the same thing with any network protocols because it is having the same story, Directly using Network APIs provided by Keil works for me but I have no understanding of how low-level interacts with the higher layer of the protocol.

Thank you
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…