- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Team,
I am trying duplex communication between Tera Term and (CY8CKIT-050)PSOC 5LP. I design PSoc Creater as below and written the below c program. Trying to communicate with tera term.
- Let me know whether the attached steps are correct or not?
- Why the serial port radio button is disabled?
I have attached all my design and code.
Thanks,
Abinash
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear abho-san,
I wonder if you are reading our responses.
Anyway, yesterday, I had a chance to visit my office after a few weeks of absence thanks for the COVID-19,
and I could grab a CY8CKIT-050 to test.
The following are the test I ran this morning.
(1) Using USB-Serial adapter
(2) Using KitProg (from CY8CKIT-043)
(3) Using USBFS as USBUART
(1) Using USB-Serial adapter
As I wrote in your other discussion before, I used a USB-Serial converter module
http://akizukidenshi.com/catalog/g/gM-08461/
It has 4 pins from top to the bottom
+5V
GND (black jumper)
TxD (green jumper)
RxD (white jumper)
Then I connected jumpers to CY8CKIT-050 as below
Black Jumper (GND) to GND
Green Jumper to PSoC's UART_RX = P0_0
White Jumper to PSoC's UART_Tx = P0_1
And 2 USB cables are connected to PC
one from CY8CKIT-050 J1 (for program and debug)
the other from the USB-Serial converter for UART input/output (This will be detected as a COM port from PC)
Then the schematic
Pins
main.c
===================
#include "project.h"
volatile char detorecibido = 0 ;
CY_ISR(InterruptRX)
{
if (UART_GetRxBufferSize() > 0) {
detorecibido = UART_GetChar() ;
}
UART_ReadRxStatus() ;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start() ;
isr_RX_ClearPending() ;
isr_RX_StartEx(InterruptRX) ;
for(;;) {
if (detorecibido == '1') {
LED_Write(0) ;
UART_PutChar('M') ;
CyDelay(500) ;
detorecibido = 0 ;
}
if (detorecibido == '0') {
LED_Write(1) ;
UART_PutChar('_') ;
CyDelay(500) ;
detorecibido = 0 ;
}
}
}
===================
From the PC, device manager(?)
I could see "USB Serial Port (COM40)"
(Sorry for these weird letters, they are called "Japanese Katakana")
Then when I debug the program, as I typed '0' and '1' I could see the LED on and off.
Note, I modified the main.c so that when I typed '1', 'M" is written
and when I typed '0', '_' is written.
Project is attached "uart_test_050_200721A"
(2) Using KitProg (from CY8CKIT-043)
Then I tried to use KitProg, which is my favorite 😉
To get this tool, we need to get a Cypress's PROTOTYPE EVB, such as CY8CKIT-043.
The picture is my two CY8CKIT-043s, one is still un-opened and the other is already separated to KitProg and the main board.
After I snipped the KitProg from the main board, I soldered pin-sockets so that using jumper wires will be easy.
The nice part of KitProg is it has both "debugger" and "USB-Serial" on board.
The right side pins (J7) are for the debugger
SWDIO
SWDCLK
RST
GND
VTARGET
And in the top side pins (J9)
the left most pin is P12[7] TX
the next pin is P12[6] RX
So I connected
Green Jumper to KitProg-P12[7]
White Jumper to KitProg-P12[6]
Another Green Jumper to KitProg-SWDIO
Another White Jumper to KitProg-SWDCLK
Blue Jumper to KitProg-RST
Black Jumper to KitProg-GND
Red Jumper to KitProg-VTARG
Then I connected these jumpers to CY8CKIT-050
KitProg-12[7] Green Jumper to CY8CKIT-050 P0_0
KitProg-12[6] White Jumper to CY8CKIT-050 P0_1
KitProg-VTARG Red Jumper to CY8CKIT-050 VIN
KitProg-GND Black Jumper to CY8CKIT-050 GND
KitProg-RST Blue Jumper to CY8CKIT-050 RESET
KitProg-SWDIO Green Jumper to CY8CKIT-050 P1_0
KitProg-SWDCLK White Jumper to CY8CKIT-050 P1_1
And connected the KitProg's USB to PC
Note only the USB cable from the KitProg is connected to PC
I used the same project as above,
And from the Menu Debug > Select Debug Target... I confirmed that PSoC Creator is seeing "KitProg"
When debugged from PSoC Creator, it worked just like the project above.
(3) Using USBFS as USBUART
Now, using the USBFS as USBUART.
You need to connect 2 USB cables from CY8CKIT-050 to PC.
One from J1 (for download and debug)
The other from J2 (for USBUART connection)
And you need to place "USBUART_cdc.inf" file which Len-san attached at the discussion
How can i integrate Psoc with c#.net?
in <Project>\CortexM3\ARM_GCC_541\Debug to let PC know what is this USB connection.
The schematic
Pins
Clock Configure
I needed to select IMO 24MHz +/- 0.25% and enable USB
ILO needed to be "100 kHz"
main.c
Note: Although the sample below seems to be working,
please refer to the datasheet and the Cypress Provided Code Example " USBFS-UART" for more information.
=============================
#include "project.h"
#define USBFS_DEVICE (0u)
char detorecibido ;
int main(void)
{
uint16 count;
CyGlobalIntEnable; /* Enable global interrupts. */
/* Start USBFS operation with 5-V operation. */
USBUART_Start(USBFS_DEVICE, USBUART_5V_OPERATION);
for(;;) {
/* Host can send double SET_INTERFACE request. */
if (0u != USBUART_IsConfigurationChanged())
{
/* Initialize IN endpoints when device is configured. */
if (0u != USBUART_GetConfiguration())
{
/* Enumeration is done, enable OUT endpoint to receive data
* from host. */
USBUART_CDC_Init();
}
}
/* Service USB CDC when device is configured. */
if (0u != USBUART_GetConfiguration())
{
/* Check for input data from host. */
if (0u != USBUART_DataIsReady())
{
detorecibido = USBUART_GetChar() ;
if (detorecibido == '1') {
LED_Write(0) ;
USBUART_PutChar('M') ;
CyDelay(500) ;
detorecibido = 0 ;
}
if (detorecibido == '0') {
LED_Write(1) ;
USBUART_PutChar('_') ;
CyDelay(500) ;
detorecibido = 0 ;
}
}
}
}
}
=============================
The teraterm log was
So it also seemed to be working.
The project is "uart_test_050_200721B"
Best Regards,
21-Jul-2020
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Abinash,
The CY8CKIT-050 has two ways to support UART serial on the board.
- Through the USBminB connector (J2). To use this you need to use the USBUART component which will automatically allocate pins P15[6] and P15[7].
- Through the on-board DB25 Sub-D connector. Note: This interface is RS232 signal levels which are >+5V to <-5V. This requires a RS232 serial interface on the PC using Teraterm. To use this use must allocate two GPIO pins for Rx and Tx of the UART component. According to your Design_Pin.png you've assigned Rx_1 to P0[0] and Tx_1 to P0[1]
To use the DB25 sub-D you need to make external wire connections from these UART port pins (Rx_1 P1 pin 18 and Tx_1 P1 pin 17 ) to the RS232 connector P5. (Rx_1 to pin 1 and Tx_1 to pin 2.)
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
- Let me know whether the attached steps are correct or not?
Those steps seem to be correct, but to connect the "UART" component in the PSoC to a PC,
a way to convert UART serial to (probably) USB is required.
To fulfill this requirement, you can use an external USB-Serial converter which I tried to explain in
wire connection to communicate psoc 5lp with pc
or, utilize USBFS component as USBUART, this requires less hardware, but more program to take care of.
- Why the serial port radio button is disabled?
Because there is no path between the UART and the PC.
In your case, if you assigned uart_rx to P0[0] and uart_tx to P0[1],
you need to connect these pins to USB-serial converter and connect USB port of USB-serial converter to your PC.
(P0[0] to tx of USB-Serial converter, P0[1] to rx of USB-Serial converter to realize a "cross" communication)
For a serial converter, you can google "USB serial converter" or "USB serial adapter"
or you can also use "KitProg" which is included in many of Cypress EVB.
For an example CY8CKIT-043, which I explained in the discussion below,
(Note: Although it's in Japanese, you can see the pictures of CY8CKIT-043 and it's KitProg usage)
Re: TSoC トラ技 5月号付録の CY8C4146LQI-S433 ボード (私の起動方法)
moto
P.S. About the ISR for uart interrupt, I posted following sample
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Motto/Len,
I can able to detect the device(dvkprog5) with the help of cyUSB.dll, but i am not able to see any COM port in below image.
I have only one wire connected to my pc from my PSOC((CY8CKIT-050)PSOC 5LP) device from J1 port . If i pass 1 then led should switch on and if i pass 0 from my c# application LED will be switch off.
See my attachment and below screen
- Need this simple application?
- Any change required in my configuration?
- I expect no more wiring required for (CY8CKIT-050)PSOC 5LP except One USB?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If I remember correct, the on-board programming USB does not work as a COM port,
so that you need to use Communication USB port along with USBFS, if you want to use it.
On the other hand, if you want to use "UART" for communication, you need USB-Serial converter
to interface the serial (UART tx/rx) to USB for PC.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
abho,
It is not clear from your last post which of the two UART interfaces you are trying to use.
Let's make this simpler.
When I start a new project I try to "borrow" working code from other projects. Since I've been using PSoCs for a while, I use my older projects as a starting point. If there is a circuit of which I'm not that familiar, I look to see if there is an example of a similar project.
For you since you are using the CY8CKIT-050 I recommend the Cypress Example project: USBFS_UART. This is a very simple project that establishes UART communication through J2 (the USB mini connector next to the programming USB mini connector). When the project is programmed and you connect to it successfully with TeraTerm, everything you type in is echoed back to the terminal. Very simple.
It is a great starting point for modifying it later to add your LED code. Note: This project includes a LCD display which can be ignored for your purposes.
Part of the issue you have with your previous configuration is that to use the RS232 port on the CY8CKIT-050 board you need to make external wiring connections.
- Rx_1: P1 pin 18 to P5 pin 1.
- Tx_1: P1 pin 17 to P5 pin 2.
Once this is done, you need a RS232 UART to USB_UART device to connect to your PC to use with TeraTerm.
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Len,
I can see my target kit is disabled as below and tera term serial port also disabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
adho,
I can see my target kit is disabled ...
You need to download the examples in this archive. https://www.cypress.com/file/45281/download
and tera term serial port also disabled.
This is because you do not have a valid COM-device (UART) installed and plugged in.
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear abho-san,
I wonder if you are reading our responses.
Anyway, yesterday, I had a chance to visit my office after a few weeks of absence thanks for the COVID-19,
and I could grab a CY8CKIT-050 to test.
The following are the test I ran this morning.
(1) Using USB-Serial adapter
(2) Using KitProg (from CY8CKIT-043)
(3) Using USBFS as USBUART
(1) Using USB-Serial adapter
As I wrote in your other discussion before, I used a USB-Serial converter module
http://akizukidenshi.com/catalog/g/gM-08461/
It has 4 pins from top to the bottom
+5V
GND (black jumper)
TxD (green jumper)
RxD (white jumper)
Then I connected jumpers to CY8CKIT-050 as below
Black Jumper (GND) to GND
Green Jumper to PSoC's UART_RX = P0_0
White Jumper to PSoC's UART_Tx = P0_1
And 2 USB cables are connected to PC
one from CY8CKIT-050 J1 (for program and debug)
the other from the USB-Serial converter for UART input/output (This will be detected as a COM port from PC)
Then the schematic
Pins
main.c
===================
#include "project.h"
volatile char detorecibido = 0 ;
CY_ISR(InterruptRX)
{
if (UART_GetRxBufferSize() > 0) {
detorecibido = UART_GetChar() ;
}
UART_ReadRxStatus() ;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start() ;
isr_RX_ClearPending() ;
isr_RX_StartEx(InterruptRX) ;
for(;;) {
if (detorecibido == '1') {
LED_Write(0) ;
UART_PutChar('M') ;
CyDelay(500) ;
detorecibido = 0 ;
}
if (detorecibido == '0') {
LED_Write(1) ;
UART_PutChar('_') ;
CyDelay(500) ;
detorecibido = 0 ;
}
}
}
===================
From the PC, device manager(?)
I could see "USB Serial Port (COM40)"
(Sorry for these weird letters, they are called "Japanese Katakana")
Then when I debug the program, as I typed '0' and '1' I could see the LED on and off.
Note, I modified the main.c so that when I typed '1', 'M" is written
and when I typed '0', '_' is written.
Project is attached "uart_test_050_200721A"
(2) Using KitProg (from CY8CKIT-043)
Then I tried to use KitProg, which is my favorite 😉
To get this tool, we need to get a Cypress's PROTOTYPE EVB, such as CY8CKIT-043.
The picture is my two CY8CKIT-043s, one is still un-opened and the other is already separated to KitProg and the main board.
After I snipped the KitProg from the main board, I soldered pin-sockets so that using jumper wires will be easy.
The nice part of KitProg is it has both "debugger" and "USB-Serial" on board.
The right side pins (J7) are for the debugger
SWDIO
SWDCLK
RST
GND
VTARGET
And in the top side pins (J9)
the left most pin is P12[7] TX
the next pin is P12[6] RX
So I connected
Green Jumper to KitProg-P12[7]
White Jumper to KitProg-P12[6]
Another Green Jumper to KitProg-SWDIO
Another White Jumper to KitProg-SWDCLK
Blue Jumper to KitProg-RST
Black Jumper to KitProg-GND
Red Jumper to KitProg-VTARG
Then I connected these jumpers to CY8CKIT-050
KitProg-12[7] Green Jumper to CY8CKIT-050 P0_0
KitProg-12[6] White Jumper to CY8CKIT-050 P0_1
KitProg-VTARG Red Jumper to CY8CKIT-050 VIN
KitProg-GND Black Jumper to CY8CKIT-050 GND
KitProg-RST Blue Jumper to CY8CKIT-050 RESET
KitProg-SWDIO Green Jumper to CY8CKIT-050 P1_0
KitProg-SWDCLK White Jumper to CY8CKIT-050 P1_1
And connected the KitProg's USB to PC
Note only the USB cable from the KitProg is connected to PC
I used the same project as above,
And from the Menu Debug > Select Debug Target... I confirmed that PSoC Creator is seeing "KitProg"
When debugged from PSoC Creator, it worked just like the project above.
(3) Using USBFS as USBUART
Now, using the USBFS as USBUART.
You need to connect 2 USB cables from CY8CKIT-050 to PC.
One from J1 (for download and debug)
The other from J2 (for USBUART connection)
And you need to place "USBUART_cdc.inf" file which Len-san attached at the discussion
How can i integrate Psoc with c#.net?
in <Project>\CortexM3\ARM_GCC_541\Debug to let PC know what is this USB connection.
The schematic
Pins
Clock Configure
I needed to select IMO 24MHz +/- 0.25% and enable USB
ILO needed to be "100 kHz"
main.c
Note: Although the sample below seems to be working,
please refer to the datasheet and the Cypress Provided Code Example " USBFS-UART" for more information.
=============================
#include "project.h"
#define USBFS_DEVICE (0u)
char detorecibido ;
int main(void)
{
uint16 count;
CyGlobalIntEnable; /* Enable global interrupts. */
/* Start USBFS operation with 5-V operation. */
USBUART_Start(USBFS_DEVICE, USBUART_5V_OPERATION);
for(;;) {
/* Host can send double SET_INTERFACE request. */
if (0u != USBUART_IsConfigurationChanged())
{
/* Initialize IN endpoints when device is configured. */
if (0u != USBUART_GetConfiguration())
{
/* Enumeration is done, enable OUT endpoint to receive data
* from host. */
USBUART_CDC_Init();
}
}
/* Service USB CDC when device is configured. */
if (0u != USBUART_GetConfiguration())
{
/* Check for input data from host. */
if (0u != USBUART_DataIsReady())
{
detorecibido = USBUART_GetChar() ;
if (detorecibido == '1') {
LED_Write(0) ;
USBUART_PutChar('M') ;
CyDelay(500) ;
detorecibido = 0 ;
}
if (detorecibido == '0') {
LED_Write(1) ;
USBUART_PutChar('_') ;
CyDelay(500) ;
detorecibido = 0 ;
}
}
}
}
}
=============================
The teraterm log was
So it also seemed to be working.
The project is "uart_test_050_200721B"
Best Regards,
21-Jul-2020
Motoo Tanaka