Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

MiKa_4247191
Level 1
Level 1
First reply posted First question asked First like given

Hi,

i use the CY8CKIT-043 with a Psco 4200M. I built the example project CE195366_PSoc4_SCB_UART.

1. When i connect the board with the USB port of the pc the first time, i don't get a output of the UART_UartPutString() function in the termial program. I have to press "Enter" -> CR that the program works.

 

2. But when the board is connected with the pc before and I program the board again, i get a output in the termial and the UART_UartPutString() function works fine.

 

3. When i code a function that preforms a SoftReset -> CySoftwareReset() i have got the same behavior like in setting 2 -> So it works

 

For the UART i use pins P7[0] and P7[1] -> USB-UART Bridge of the KitProg

 

What's wrong in setting 1...??

 

Here is the code:

#include <project.h>

int main()
{
uint32 ch;

/* Start SCB (UART mode) operation */
UART_Start();

UART_UartPutString("\r\n***********************************************************************************\r\n");
UART_UartPutString("Welcome to the CE95366 example project\r\n");
UART_UartPutString("If you are able to read this text the terminal connection is configured correctly.\r\n");
UART_UartPutString("Start typing characters to see an echo in the terminal.\r\n");
UART_UartPutString("\r\n");

for (;;)
{
/* Get received character or zero if nothing has been received yet */
ch = UART_UartGetChar();

if (0u != ch)
{
/* Transmit the data through UART.
* This functions is blocking and waits until there is a place in
* the buffer.
*/
UART_UartPutChar(ch);
}
}
}

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
500 solutions authored 1000 replies posted 750 replies posted

MiKa,

I'll make an educated guess to the problem with setting 1.

Based on the code you shared, the issue appears that you are dumping info to the terminal IMMEDIATELY at CPU boot up.  In setting 1, you indicate that you plug in the USB of the 4200 to the PC for the first time.   If the 4200 is already programmed, then the "splash screen" output is pushed to the UART port within a few milliseconds of acquiring power through the USB cable.  If the terminal program is not up and the port is not open at this powerup, the splash screen output chars are dumped into the 'ether'.  They are lost forever.  Time is taken to open the host terminal program and port.   The CR works because the program is waiting for it at the for(;;) loop.

Settings 2 and 3 already have ther host terminal port open and listening to the UART output from the 4200.

Suggestion:

Add the following code:

while(UART_UartGetChar() == 0u){}

Just below the UART_Start();

This added code will wait for any character to start the splash screen dump.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
2 Replies
MiKa_4247191
Level 1
Level 1
First reply posted First question asked First like given

Is there a SoftReset counter in the psoc4...??

0 Likes
Len_CONSULTRON
Level 9
Level 9
500 solutions authored 1000 replies posted 750 replies posted

MiKa,

I'll make an educated guess to the problem with setting 1.

Based on the code you shared, the issue appears that you are dumping info to the terminal IMMEDIATELY at CPU boot up.  In setting 1, you indicate that you plug in the USB of the 4200 to the PC for the first time.   If the 4200 is already programmed, then the "splash screen" output is pushed to the UART port within a few milliseconds of acquiring power through the USB cable.  If the terminal program is not up and the port is not open at this powerup, the splash screen output chars are dumped into the 'ether'.  They are lost forever.  Time is taken to open the host terminal program and port.   The CR works because the program is waiting for it at the for(;;) loop.

Settings 2 and 3 already have ther host terminal port open and listening to the UART output from the 4200.

Suggestion:

Add the following code:

while(UART_UartGetChar() == 0u){}

Just below the UART_Start();

This added code will wait for any character to start the splash screen dump.

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