- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hey,
I wanted to use printf() in my project, so I looked up how to make it work. I included stdio.h, increased the heap size to 0x200, and added the following to the beginning of my code:
int _write(int file, char *ptr, int len)
{
int i;
file = file;
for (i = 0; i < len; i++)
{
UART_PutChar(*ptr++);
}
return len;
}
this makes it so I can use printf, but when I printed printf("uart test") it output "uart tes", missing the last character. I tried printing twice; "test1" and "test2" and the first string came out correctly ("test1") but the second printf was missing the last character again, giving "test". I can sprintf after with no issues, just the last printf() loses the last character
what is going on there? what do I need to adjust?
I'm using the CY8CKIT-059 and a FTDI cable (which has been working fine)
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob,
I can't post the project to which I was adding it due to the code being proprietary. I made a new project to re-create the problem and it just worked. I'll have to look at what in the code might be interfering.
xzng, I'll try that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob,
I can't post the project to which I was adding it due to the code being proprietary. I made a new project to re-create the problem and it just worked. I'll have to look at what in the code might be interfering.
xzng, I'll try that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0x200 heap size maybe not enough, try to change the heap size to 0x300.