so lets start simple,
have you tried a different sd card? or tried a different sector? (not all SD cards are equal)
have you made sure the card lock switch is in the correct position? (im sure you have but just want to make sure.)
are you able or do you know how to use "dd" to see if you actually have written to the sd card? (dd is a command to either write or read raw data from a disk or image.) we want to verify that you are actually writing to the sd card
The code looks good, but i dont use RTOS, and dont have a way to test at this time, im sure i could but I dont have time to get it wall setup.