Problem using snprintf() in static thread

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Problem using snprintf() in static thread

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Problem using snprintf() in static thread

Post by Giovanni »

Probably a stack overflow, libraries are not exactly designed for embedded.

Giovanni
nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Re: Problem using snprintf() in static thread

Post by nikhil »

Any suggestion for alternate solution to this issue?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Problem using snprintf() in static thread

Post by Giovanni »

Use chsnprintf()?

Giovanni
nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Re: Problem using snprintf() in static thread

Post by nikhil »

Tried using chsnprintf() but it also gives 214748368s and 0s instead of desired values.


--
Nikhil
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Problem using snprintf() in static thread

Post by Giovanni »

You are looking for the wrong thing then.

Giovanni
Post Reply