debug printf never returns and does not output to the USB com port

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

cross mob
Anonymous
Not applicable

PSoC creator 4.1, cyc8ki-042-BLE pioneer board, 222014 plugged in. USB connected to PC. teraterm running connected to the provided com port.

Create new project for the above.

in main, add printf("hello world\n");

build, debug, run. program hangs up (printf never returns). no output on teraterm.

Whiskey Tango Foxtrot?

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Kindly refer to the code examples for PSoC-4 BLE. Most of them have printf implemented usng UART component. Have a look at the file "debug.c" in which _write function which is required to redirect the strings to UART.

Please make sure that you connect the UART TX and RX pins to the appropriate pins, so that the kitprog USB-UART bridge can display the UART data properly.

Thanks,

Hima

View solution in original post

6 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Can you attach the project ?

Thanks,

Hima

0 Likes

A PSoC hasn't got an operating system, so it does not know about interfaces to send your text to when using printf().

Easiest way out:

Use spirntf(buffer,... and then send the resulting string to your interface with the standard APIs, in your case probably USBUART_PutString(Buffer)

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob. how do I add a USBUART device so that call is defined?

0 Likes

Read the Kitprog manual, your PSoC4 hasn't got an USB. You need to use an UART and the pins which are connected to the Kitprog as serial to USB bridge, see kit's schematic under C:\Program files (x86)\Cypress\...

Bob

0 Likes
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Kindly refer to the code examples for PSoC-4 BLE. Most of them have printf implemented usng UART component. Have a look at the file "debug.c" in which _write function which is required to redirect the strings to UART.

Please make sure that you connect the UART TX and RX pins to the appropriate pins, so that the kitprog USB-UART bridge can display the UART data properly.

Thanks,

Hima

lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Here is program that works for printf debug. It is set for the PSOC ble module . It should work for all of the modules however.

0 Likes