- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Like a Hyper Terminal terminal as COM test software on HOST.
Data receve from the USBUART is work well.(check with terminal software)
・The sample code is as follows
if(CHP.TUACHON != CHP.TUACH_BK)
{
CHP.TUACH_BK = CHP.TUACHON;
if(CHP.TUACHON)
USB_TxData("T-ON");
else
USB_TxData("T-OFF");
}
}
void USB_TxData(char *Str)
{
while(USBUART_CDCIsReady() == 0);
USBUART_PutString(Str);
}
---------------------------------------------------------
Received data chack routine is as follows
---------------------------------------------------------
while(1) {
if(USBUART_DataIsReady() > 0)
{
USB_TxData("Get data=");
USBUART_GetAll(&buff[0]);
}
}
The problem is that this USBUART_DataIsReady () functionIt does not return a value of greater than 0.
I look forward to good advice. Thank you
Solved! Go to Solution.
- Tags:
- usbuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The things to be noted down is :
>> Move the USBUART_DataIsReady() and corresponding code to do while(1) function body, USBUART_DataIsReady() is returning non zero when it receives data from terminal otherwise if you check at a time instance when it has not received any data from terminal, it will return zero.
>>Use
while(0==USBUART_GetConfiguration()) {};
instead of
while(USBUART_GetConfiguration()) {};
Thanks,
Ankita
- 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
Changed as follows according to the sample code
The result was the same.
if(USBUART_DataIsReady() > 0) --> if(USBUART_DataIsReady() != 0)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't meant that that changing if(USBUART_DataIsReady() > 0) to if(USBUART_DataIsReady() != 0) will help.
I meant check whether you are using USBUART_DataIsReady() at correct place in code.
Can you share your project.
- 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
Hello,
I cannot open the PSoC Creator project attached in PSoC Creator 4.2.
Can you please open the PSoC Creator project in PSoC Creator 4.2, then right click it and choose to Archive it with option " Complete".
Then send that archived project available in Archive named Folder available within the .cydsn project folder.
Thanks,
Ankita
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Your observation is correct.
In your project attached, you are checking USBUART_DataIsReady() only once in while (Flag) condition body, but if you move the USBUART_DataIsReady() and corresponding code to do while(1) function body, USBUART_DataIsReady() is returning non zero when it receives data from terminal.
I have verified this and attaching the modified project.
Thanks,
Ankita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a result of checking the operation of the changed program, it has been confirmed that it is operating properly.
So I checked the original code again, I found a big mistake.
A series of codes in the USB_Initialize () function It was as follows.
USBUART_Start(0, USBUART_3V_OPERATION);
while(USBUART_GetConfiguration()) {};
USBUART_CDC_Init();
So I changed it as follows All solved.
;
while(0==USBUART_GetConfiguration()) {};
;
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Finally
The process for closing this subject is What should I do?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The things to be noted down is :
>> Move the USBUART_DataIsReady() and corresponding code to do while(1) function body, USBUART_DataIsReady() is returning non zero when it receives data from terminal otherwise if you check at a time instance when it has not received any data from terminal, it will return zero.
>>Use
while(0==USBUART_GetConfiguration()) {};
instead of
while(USBUART_GetConfiguration()) {};
Thanks,
Ankita