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.

CC3200-LAUNCHXL: CC3200-LAUNCHXL: UART_if Report function not working

Part Number: CC3200-LAUNCHXL
Other Parts Discussed in Thread: CC3200

Hello,

I was trying to build a small code to read the RTC from a DS1307 module. During the same, I wanted to report the data to a PC terminal through UART. I checked the example program in spi (spi_demo) which was exactly doing the same using a Report API call.

When I Incorporated the same in my project, the Report function does nothing upon calling. When I tried debugging, I found that the pcBuff = (char*)malloc(iSize); is always returning a NULL. I even tried changing the int iSize = 256; to int iSize = 64; but no luck. 

Can you please help me if there is a way out to get the Report function working? It would be of great help to debug the SPI interface issues.

Regards,

Shankar

  • Hello Shankar,

    This demo works for me fine.

    Are you trying to run the demo on CC3200 launchpad "as is" and it does not print?

    Let me explain a little on how malloc works with no-OS.

    The implementation is on the compiler libraries. The compilers are on CCS pre-compiled libraries.

    The compiler can be located when you right click the project and go to properties. There, you should see a variable GC_TOOL_ROOT. for me it points to ti-cgt-arm_5.2.7. What is the compiler in your case? is it there? what CCS version are you using?

    In addition, please check that you have the include to stdlib.h where it is defined and also that the linker has libc.a library (you should see it under ARM Linker->File search Path.

    Regards,

    Shlomi

  • Hello Shlomi,

    The demo works fine! Its the new project that I created and included all the necessary components that does not work. The compiler am using is arm_15.12.3.LTS and am using ccs Version: 6.2.0.00050 . I have all the includes and libraries in place. In fact the Message API from uart_if works as expected in my project. Its only the Report API that fails and that too at the malloc function. I have tried comparing the map files and also linker commands. I could not make out if anything is wrong!

    Where else can I look? Please suggest

    regards,
    Shankar
  • Hello Shankar,

    No surprise that Message API works as it does not use memory allocation but directly write into UART.

    Hard to tell what is wrong in your case that prevents you from allocating memory.

    If you just need it for debug, and to not block you, I suggest using sprintf to create the string buffer and then use Message API.

    Let me know if this would work for you.

    Regards,

    Shlomi

  • Thanks a lot for that lead! I modified the Report API! instead of malloc, I used an array of 256 bytes. Am sure I will not land up in a size excess to that so I do not need realloc. This works now! Thank you very much.

    Regards,
    Shankar
  • Finally found the actual issue. The project makefile had --heap_size=0x00. Just added enough heap in project settings and it started working fine.

    Regards,
    Shankar