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/MSP430FR5969: printf in MSP430

Part Number: MSP430FR5969

Tool/software: Code Composer Studio

I am trying to use printf with MSP430FR5969 board. 

I have tested with basic helloworld project and it works well. 

Now I am trying to use printf in my project I am now working on, because I want to use printf for logging my project. 

But the CIO console is not showing up when I run the other project.

What is this problem about?

how can I see CIO console? 

Best regards, 

Mirae

  • Mirae,

    I am thinking that you might be running out of heap space. You could try increasing the size of your heap and see if that resolves the issue.

    There is more information on using printf with MSP430 here:
    processors.wiki.ti.com/.../Printf_support_for_MSP430_CCSTUDIO_compiler

    Regards,
    John
  • Hello, 

    Thank you for the reply.

    I tried the steps written in this page, processors.wiki.ti.com/.../Printf_support_for_MSP430_CCSTUDIO_compiler but it is still not working. 

    I checked enabling CIO, but still does not showing up. 

    Do you have another recommendation with this problem? 

    Best, 

    Mirae

  • Mirae,

    Could you attach the project?   I could take a look at its settings.

    John

  • You can export the project in CCS by right clicking on the project in the project explorer and selecting Export. Then in the dialog box that opens select General -> Archive file. You will then be able to export the project as a zip.
  • I attached the project I am working with. 

    Best regards, 

    Mirae

    8054.RTOS.zip

  • Mirae,

    Looking at the project I can see the heap size is set to 160.  This will not be big enough.  The heap option is shown below.  Try a value of 300 or 320 for this.

    Regards,

    John

  •  already have tried it. But I changed it to 160 again after that because It did not work. 

    I attached the project with the heap value 320.

    RTOS_ver2.zip

  • Mirae,

    I am going to need to get FreeRTOS and get that setup to try to build this project. I suspect that FreeRTOS needs additional heap but I am not familiar with using it at all.

    John
  • I downloaded FreeRTOS and ran the demo. To get it to build I had to change the printf support in the options to full from minimal. Printf is not outputting anything for me either. I stepped through the code and I can see that the project includes its own version of printf and not the one that comes with the TI Compiler C runtime support library. I won't be able to help you with using that. If you want to use that then someone from FreeRTOS would need to help. Maybe a community member in the MSP430 forum might know how it works.

    I was able to get printf working by doing the following:
    put the printf support back to minimal so that it fits in memory (project properties, build->MSP430 Compiler->Advanced options->language options)
    exclude the printf-stdarg.c file from the project (right click on it and select exclude from build).
    set the heap to 320
    build
    comment out the sprintf lines that cause build errors
    build again
    run
  • I really appreciate for your help.

    I do not know if the issue follwing is related to this topics...

    I just figured it out how to use printf with MSP430 board.

    But now I faced another problem... 

    my problem is ....

    when I am printing some characters with printf function in while loop, It suddenly stop printing out something even if the while loop is still running.

    Is this a memory problem? Because MSP430 has restriction in memory?  

    Best, 

    Mirae

  • The heap allocation for the printf would happen with the first use so it should not be an issue of running out of heap.

    One thing to note about the printf in our C runtime library is that a breakpoint is set and when the printf is encountered the application halts and the string gets transferred and then we run the application again. So if you have interrupts in the application it can be problematic. For our own RTOS (TI-RTOS) we provide different printf called System_printf that does not use the breakpoint method. I suspect that the version that the FreeRTOS demo was using was something similar but I do not have any experience with it.

    Are you tied to using FreeRTOS?

    John
  • Yeah, I am using FreeRTOS but I am using TI provided printf in FreeRTOS project.

    Maybe interrupt in the application is causing this problem as you mentioned.
    I should try to use FreeRTOS provided printf again for this issue.

    Best regards,
    Mirae
  • The FreeRTOS provided printf is likely to be smaller and use less memory. Ultimately it would be a better choice. I am not sure how it works though. Maybe it sends the printf over a uart and you can view in a terminal?