using FATFS library with microSD Card disables buttons on XMC4800

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User20173
Level 2
Level 2
First solution authored
Hello ))

I have prepared a code to work with SD card on XMC4800.

in the application I call f_mount/f_open/f_read/f_write and so on.
SD card works fine, all my operations finish successfully (files are read/write) and I call f_close.

As soon as I finish SD read-write, the board does not see buttons pressed anymore.


if ( !(PORT15->IN & PORT15_OUT_P13_Msk) // Button1
|| !(PORT15->IN & PORT15_OUT_P12_Msk) // Button2
)
{
PORT5->OMR = 0x00000200; // LED1 ON
}
else
PORT5->OMR = 0x02000000; // LED1 OFF


Means, the PORT15->IN = all time 0 even if button is pressed.

What FATFS has to do with buttons on infineon XMC4800?
What can be a reason?
0 Likes
1 Solution
User20173
Level 2
Level 2
First solution authored
Solution!

My failure was to call
f_mount(&FATFS_0, "0", 1);

where FATFS_0 is a default generated controller.

When I switched to
f_mount(&fs, "0", 1); where "fs" is just my own global application vairable (not local in a function!), everything works fine.

So, I think there was an issue with memory access due to usage of wrong pointer.

View solution in original post

0 Likes
1 Reply
User20173
Level 2
Level 2
First solution authored
Solution!

My failure was to call
f_mount(&FATFS_0, "0", 1);

where FATFS_0 is a default generated controller.

When I switched to
f_mount(&fs, "0", 1); where "fs" is just my own global application vairable (not local in a function!), everything works fine.

So, I think there was an issue with memory access due to usage of wrong pointer.
0 Likes