cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

user_4457186
New Contributor

Hello,

I'm trying to read the data sent from a HC-SR04 sensor in the computer terminal using TeraTerm. Before I started doing this, I made sure everything was working well in my program and the sensor and so it does: I used an LCD display and everything is fine. The problem is that I don't know how to send this data using the USBUART (CDC Interface).

The project can be found attached to this message. I am using the CY8CKIT-050 PSOC 5LP DEVELOPMENT KIT Could anyone please help me?

Thanks in Advance.

0 Likes
1 Solution
MotooTanaka
Esteemed Contributor

Hi,

As I could not open the attached project,

I reused my HC-SR04 project for CY8CKIT-059

and modified it for CY8CKIT-050 and USBUART.

During the task, what I noticed were

(1) I needed to add "USBUART_cdc.inf" file which was with the original application note.

(2) To use USBUART just like UART, I needed to do

===============

    USBUART_Start(USBFS_DEVICE, USBUART_5V_OPERATION);

    /* Wait for Device to enumerate */

    while(!USBUART_GetConfiguration());

  

    /* Enumeration is done, enable OUT endpoint for receive data from Host */

    USBUART_CDC_Init();

===============

TeraTerm log

001-USBUART-050-TeraTerm.JPG

IMG_4024.JPG

moto

View solution in original post

0 Likes
3 Replies
Ekta
Moderator
Moderator

Hello,

Please refer to the link for USBFS-UART  code example given below:

PSoC4-MCU-USB-Connectivity-Designs/USBFS_UART at master · cypresssemiconductorco/PSoC4-MCU-USB-Conne...

This code example demonstrates the USBUART implementation. It echoes received data to the Virtual COM port terminal.

Best Regards

Ekta

0 Likes
Len_CONSULTRON
Honored Contributor II

Hi,

If you're interested, I've attached a link to contributed source code that uses the USBUART with a simplified interface.

GetString() function that supports input character filtering. Includes menu-driven commands.

The simplified USBUART interface was intend to help users that constructed a UART API calls primarily for the 059-Kit board to switch to the 059-Kit on-board USB port with minimal changes.  It simplifies the additional coding needed to address USB-specific controls.

The source code has the following features:

  • UART to USBUART simplied API call interface.
  • GetString() function call to process input string data that can filter the input to only allow characters for a input string type.  Input string types supported:
    • Unsigned and signed integers.
    • Signed and unsigned numbers with values after the decimal point.
    • Unsigned Hexadecimal numbers.
    • Strings.  (of course)
    • File-system allowed string characters.
  • A character-based menu driven system for terminal support.   This can be user expanded as needed.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
MotooTanaka
Esteemed Contributor

Hi,

As I could not open the attached project,

I reused my HC-SR04 project for CY8CKIT-059

and modified it for CY8CKIT-050 and USBUART.

During the task, what I noticed were

(1) I needed to add "USBUART_cdc.inf" file which was with the original application note.

(2) To use USBUART just like UART, I needed to do

===============

    USBUART_Start(USBFS_DEVICE, USBUART_5V_OPERATION);

    /* Wait for Device to enumerate */

    while(!USBUART_GetConfiguration());

  

    /* Enumeration is done, enable OUT endpoint for receive data from Host */

    USBUART_CDC_Init();

===============

TeraTerm log

001-USBUART-050-TeraTerm.JPG

IMG_4024.JPG

moto

View solution in original post

0 Likes