- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem with strtok. I use it to part command and value or only command.
In PSOC4 it works with the CY8CKIT_049. In PSOC5 it don't work with CY8CKIT_059.
In PSOC4 it retun on an empty string NULL and in PSOC5 other than NULL.
What is the different?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have found the error. It was an Compiler-error. I have in Building Settings at Compiler->Optimization Level set from "Size" to "Minimal".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both CPUs use the same compiler and probably the same library. Can you please create a workspace with the two examples to check?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have found the error. It was an Compiler-error. I have in Building Settings at Compiler->Optimization Level set from "Size" to "Minimal".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem with strtok,I'm try to solve the problem, I found key word "printf" then run "strtok" ,it will hung up
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
char buffRx[] = "GET / HTTP/1.1";
char * nexttok;
printf("Hello");
nexttok = strtok(buffRx," "); // nexttok = strtok((char*)buf," ");
printf("Strtok test :\%s", nexttok);
for(;;)
{
/* Place your application code here. */
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum, Arnold.
Tell us Which board you are using (Name starts with CY8CKIT-,,,,,)
The PSoC has not got an OS, so how should it know where to send the data to.
At first #include <stdio.h>
Then put an UART component onto your topdesign page. The Rx and Tx pins must be connected to the UART - USB bridge of your Kit board. See schematic of the board.
Then you can use a terminal emulation program as PuTTY to display ASCII data using an emulated COM: port.
Use sprintf() and UART_PutString() to send data to the PC
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob
My test board is CY8CKIT-042-BLE,I'm try add UART component, PuTTY's screen display the "Hello",but same hung up at "strsok" function。
I don't know how to solve the problem, I am new here,Thanks for Bob help。
#include <project.h>
#include <string.h>
#include <stdio.h>
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
UARTprint_Start();
char buffRx[] = "GET / HTTP/1.1";
char * nexttok;
printf("Hello");
nexttok = strtok(buffRx," "); // nexttok = strtok((char*)buf," ");
printf("Strtok test :\%s", nexttok);
for(;;)
{
/* Place your application code here. */
}
}
int _write(int file, char *ptr, int len)
{
int i;
file = file;
for (i = 0; i < len; i++)
{
UARTprint_UartPutChar(*ptr++);
}
return(len);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob
I solved the problem,I adjust Heap Size from 0x200 to 0x400。Now Heap Size set to 0x800,My project can contium debug......
Thanks again Bob。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are always welcome!
Bob