This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28069M: Problem using Sprintf

Part Number: TMS320F28069M


Tool/software: Code Composer Studio

Hi,

I'm working with F28069M launchpad and now I'm trying to format a string to be sent out through SCI to the PC for updating some values in GUI. I have no problems regarding sending characters to the PC using SCI, I'm working with SCI interrupt and everything works fine! The problem is now I want to format a string which plays the role of a so-called protocol of sending/receiving data between the Microcontroller and the Client, anyways I tried to use "sprintf" function to format my string but whenever the code reaches to this part everything hangs and nothing proceed(during runtime), I spent a full morning reading the whole Ti blog and wiki and tried to increase the heap and stack size based on here but no changes! so can you recommend me what are the other solutions or problems. (it worth mentioning that I'm also trying to format some float numbers inside)

Regards

Milad

  • You don't say what your original stack size was, and what you increased it to.

    I have had similar problems with sprintf on 2 different TI processor families. You have to open the memory viewer to the stack area and look at how much space gets changed when you call sprintf. It doesn't matter if you're printing something simple. I had to set the stack to 1k on one family, and 2k on another. There's no substitute for looking at how much memory gets touched when you make the subroutine call.

  • Thanks for the reply, My heap memory size is 0x400 and the stack size is 0x200, but would you mind telling me about how can I access the stack area through memory viewer? and afterwards how can I know what amount of memory will be sufficient (you meant just more than sprintf needs?)
  • Heap doesn't help you here, you need stack, and as I said above, 1-2k is a good start. This would be 0x400 to 0x800, so I suggest setting stack size to 0x800 and see if that fixes your problem.

    I'm not familiar with the processor you're using, but use View->Memory Browser and look in the area where your stack is located. If you're not sure where that is, check the linker map.