Page 1 of 1

Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 10:00 am
by nikhil
Hello,

I am using MMC SPI to log float values to microSD card using STM32F4 MCU and Chibios 2.6.5.
I have mostly followed demo from chibios. I am using snprintf() function to convert float to string and then write them file.
This method works perfectly when I call write function from main thread. However when I call this write function from any other static thread, I get 0 and -268156 values written on SD card and none of expected value.
I have added syscall.c to makefile.
Am I missing something? Is there any difference in the execution of main thread and any other static thread?

--
Nikhil

Re: Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 12:23 pm
by Giovanni
Probably a stack overflow, libraries are not exactly designed for embedded.

Giovanni

Re: Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 12:30 pm
by nikhil
Any suggestion for alternate solution to this issue?

Re: Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 12:33 pm
by Giovanni
Use chsnprintf()?

Giovanni

Re: Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 1:03 pm
by nikhil
Tried using chsnprintf() but it also gives 214748368s and 0s instead of desired values.


--
Nikhil

Re: Problem using snprintf() in static thread

Posted: Sat Aug 02, 2014 1:38 pm
by Giovanni
You are looking for the wrong thing then.

Giovanni