Why doesn't scanf work when used in a task? How can I solve the problem? I use STM32 and the standard retarget with uart. I see that only scanf doesn't work, gets() and printf() for example doesn't make me any problem! Thnks
If you have watched the stack as I suggested and the return address is clearly obvious, then I would guess that the parameters list for your scanf() call are not setup correctly.
http://www.keil.com/support/man/docs/c251/c251_scanf.htm
BTW: I seem to vaguely remember that the scanf() routine does use a 'boatload' of stack space.
Also, you can try to remove the scanf() function call and replace it with something more simplistic for test purposes.
For example, does _getkey() work from your call and return properly?
"replace it with something more simplistic for test purposes."
Actually, it might be worth doing a 'Search' on this forum for "scanf" - and, in the light of what you find, then re-considering whether you really want to be using it at all...
That would be the C251 version - you should be looking at the ARM version...