- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got the USB serial working.
Wrote a little function to make the calling code cleaner. Noticed I need to give 2 bytes for the first one to show up.
There is a non-flushed buffer somewhere.
I isolated it down to the below.
(Same case with the original code.)
//========================================================================
// int is_data_ready( uint32_t port )
// call: port: port number
//
// driver function just returns a boolean. If error, returns false
//
// NOTE: This has an off-by-one bug
// Cy_USB_Dev_CDC_IsDataReady() is behind one byte
// The finction is in .\libs\usbdev\cy_usb_dev_cdc.c
// It calls Cy_USBFS_Dev_Drv_GetEndpointState()
// which is an inline macro in libs\psoc6pdl\drivers\include\cy_usbfs_dev_drv.h
// It uses:
// cy_stc_usbfs_dev_drv_context_t const *context
// context->epPool[CY_USBFS_DEV_DRV_EP2PHY(endpoint)].state
// we will need to deal with it.
// Note we are sending data across the USB from a computer.
// We can just send an extra NL
//
//========================================================================
int is_data_ready( uint32_t port )
{
if( Cy_USB_Dev_CDC_IsDataReady( port, &usb_cdcContext ))
return( 1 );
else
return( 0 );
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello baga_4725781
We have tested the USB CDC Echo code example and noticed that the first letter that we provide is displayed on the Terminal immediately without the need to provide two bytes.
We have also tried programming the project (USB_CDC_Echo) provide by you in the thread: Issues with the USBFS UART example
and we have made the same observation.
We were using Tera Term for the testing.
Can you please let us know the terminal emulator that you have been using? Please let us know if the same issue can be observed using tera term.
Best Regards
Ekta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello baga_4725781
We have tested the USB CDC Echo code example and noticed that the first letter that we provide is displayed on the Terminal immediately without the need to provide two bytes.
We have also tried programming the project (USB_CDC_Echo) provide by you in the thread: Issues with the USBFS UART example
and we have made the same observation.
We were using Tera Term for the testing.
Can you please let us know the terminal emulator that you have been using? Please let us know if the same issue can be observed using tera term.
Best Regards
Ekta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use putty by default.
I have some Windows serial port code.
I am trying to just use that to see if a low-leveli/o will work or have the same issue.
Stay tuned ... yours ... bandit