Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Not open for further replies.


Advanced Member level 4
Jun 5, 2017
Reaction score
Trophy points
Bhubaneswar, India
Activity points
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.


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

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

Can anyone suggest a few reference manuals to understand the in-depth Embedded File system and FAT and Network protocols? It would be a great help.

Thank you.

Not open for further replies.

Part and Inventory Search

Welcome to