- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am using a code example (CE218964 - PSoC 6 MCU RTC Daily Alarm). the printf() functions does not print to serial port.
I had the same issue with all the code examples that use printf(). I had to replace it with UART_put or UART_putstring().
I read many threads to find a solution, for example changing heap size, or adding "fflush(stdout);". None of those proposed solutions work.
Any help ?
also what does the heap have to do with the operation of printf() ?
thanks
Solved! Go to Solution.
- Labels:
-
PSOc6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue is in the stdio_use.h. Please replace the SCB instance in lines 166 and 167 to SCB5 instead of SCB0 as we are using SCB5 in this project. This should enable printf in your project.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you let us know what device you are using? I tried the CE at my end on the 062-BLE kit and it is working as expected. Also, do not replace or delete the stdio_user.h file if prompted by PSoC Creator.
The printf() function uses dynamic memory allocation. This is why we need to allocate sufficient heap memory for the code to work.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hari
Thanks for the help.
I am using PSoC63 (CYBLE-416045-02, the SMT-43 module).
I started with an example code from PSoC and I approved the recommend removal of unused files by PSoC Creator. Which files do I have to include so that I would make the printf() work ?
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue is in the stdio_use.h. Please replace the SCB instance in lines 166 and 167 to SCB5 instead of SCB0 as we are using SCB5 in this project. This should enable printf in your project.
Best regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hari
It worked, thank you.
One more question, how would I know which SCB is chosen ? so that in the future, I can modify the stdio_user.h
thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can identify the SCB block from the pins tab in PSoC creator. Once you select the pin to be used as UART Tx (or Rx) it will show you the corresponding SCB block in the drop down menu -
Best regards,
Hari