FatFs: trying to use f_getcwd, Default ISR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FatFs: trying to use f_getcwd, Default ISR

1,587 Views
neilporven
Senior Contributor I

Hi everyone,

 

I would like to use the following function to retrieve the current working directory: f_getcwd

 

TCHAR *filename;               //Pointer to the buffer to receive the current directory string

 

//Get current working directory

fr = f_getcwd (filename,sizeof(filename));

 

After stepping over this line, the software goes to Default ISR.

 

I am not sure if I am defining the buffer correctly, there really isn't an example I can follow.

 

Has someone worked through this issue?

 

Thanks,

Neil

Labels (1)
0 Kudos
11 Replies

1,013 Views
neilporven
Senior Contributor I

Ok,

another hint after digging around a bit more:

ISR issue3.jpg

It seems that it comes from Reset_Handler......

Not sure what or how this is happening???

0 Kudos

1,013 Views
BlackNight
NXP Employee
NXP Employee

The Outline only shows you the first match.

I still think you are running into a hard fault. Unless do you have a HardFault_Handler defined in your system (do you?).

Keep in mind that the default handlers are 'weak' (see line 356).

Bottom line: add that hardfault handler as outlined in my article so you know what is happening.

I hope this helps,

Erich

0 Kudos

1,013 Views
neilporven
Senior Contributor I

If I am not using PE, how do I go about doing that?

Thanks.

0 Kudos

1,013 Views
BlackNight
NXP Employee
NXP Employee

Simply add the 'Extended Handler' from Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse   to your application.

Instead of

PE_ISR(Cpu_ivINT_Hard_Fault)

use

void HardFault_Handler(void)

Erich

0 Kudos

1,013 Views
neilporven
Senior Contributor I

Hi Erich,

I couldn't figure out how to do what you suggested, but I was to f_getcwd working.

First Declaration:

char  filename[256];

Second Function Call:

fr = f_getcwd (filename,sizeof(filename));

Finally, the result:

"1:/", '\0' <repeats 96 times>

LOL....... that's not what I needed.  I was looking for the filename: "Log_Data.txt"

Regardless, Thank You for your help.

0 Kudos

1,013 Views
prachipanse
Contributor III

Hi,

I am also seeing a similar error where the software goes to the HardFault_Handler() on using f_getcwd() function. I have not defined anything in the void HardFault_Handler(void) routine. I am using the LPC1313 microcontroller with LPCOpen library.

Please suggest what may be done. 

Thanks and Regards.

0 Kudos

1,013 Views
BlackNight
NXP Employee
NXP Employee

keep in mind that FatFS needs more stack than without using FatFS. I suggest you increase the stack size.

0 Kudos

1,013 Views
prachipanse
Contributor III

Thanks for your suggestion. How do I increase the stack size in LPCxpresso?

0 Kudos

1,013 Views
prachipanse
Contributor III

Hi,

Could you please suggest to me how to increase the stack size in LPCxpresso?

Thanks.

0 Kudos

1,013 Views
BlackNight
NXP Employee
NXP Employee

Hi Neil,

Is that default ISR a hard fault?

I suggest you find out where the it happens, e.g. with Debugging Hard Faults on ARM Cortex-M

I hope this helps,

Erich

0 Kudos

1,013 Views
neilporven
Senior Contributor I

Hi Erich,

I don't believe it is, I am pasting what the debugger is showing:

ISR issue.jpg

Notice that its not showing the ISR.

I have a picture of the actual spot:

ISR issue2.jpg

I am not sure if I'm declaring this correct or using it correctly:

//Get current working directory

fr = f_getcwd (filename,sizeof(filename));

0 Kudos