Featured Discussions
Hi,
I have always wanted to use printf in projects created with CY8CKIT-041S-MAX on Modus tool box.
It was very convenient once I figured out how to use it.
However, I spent a lot of time trying to figure out what settings were necessary and what were not.
So I thought I would share this with you to help you understand.
I modified the "Hello_World" that I got from BSP.
I also referred to this topic:
https://community.infineon.com/t5/Blogs/Using-the-retarget-io-library-to-enable-printf/ba-p/247044
The following steps will enable you to use printf().
STEP1. Add a library
Hello_world project obtained from BSP is missing a header file to use printf.
Therefore, add the necessary libraries from the Library Manager and make the file structure the same as in the image below.
STEP2. Setting up with device configurator
Uncheck the preconfigured UART checkbox.
STEP3. Write the main code
When writing the main code, the following points are important
- Prototype declaration in #include "cy_retarget_io.h
- Specify the Rx and Tx ports of the UART
- Call cy_retarget_io_init()
NOTE:
CY_RETARGET_IO_BAUDRATE, which sets the baud rate, did not need to be declared in the main code.
It is already defined in "cy_retarget_io.h".
If you need to change the baud rate, the easiest way is to change the value of CY_RETARGET_IO_BAUDRATE defined in "cy_retarget_io.h".
main.c
/******************************************************************************
* File Name: main.c
*
*****************************************************************************
/*******************************************************************************
* Include header files
******************************************************************************/
#include "cy_pdl.h"
#include "cybsp.h"
#include "cy_retarget_io.h"
/*******************************************************************************
* Macros
*******************************************************************************/
#define LED_DELAY_MS (1000u)
#define CY_ASSERT_FAILED (0u)
#define CYBSP_DEBUG_UART_TX (P0_5)
#define CYBSP_DEBUG_UART_RX (P0_4)
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Parameters: none
*
* Return: int
*
*******************************************************************************/
int main(void)
{
cy_rslt_t result;
/* Initialize the device and board peripherals */
result = cybsp_init();
/* Board init failed. Stop program execution */
if (result != CY_RSLT_SUCCESS)
{
CY_ASSERT(CY_ASSERT_FAILED);
}
result = cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE);
if (result != CY_RSLT_SUCCESS)
{
CY_ASSERT(CY_ASSERT_FAILED);
}
/* Enable global interrupts */
__enable_irq();
for(;;)
{
/* Toggle the user LED state */
Cy_GPIO_Inv(CYBSP_USER_LED1_PORT, CYBSP_USER_LED1_PIN);
/* Wait for 0.5 seconds */
Cy_SysLib_Delay(LED_DELAY_MS);
printf("\rいつもお世話になっております\r\n");
}
}
/* [] END OF FILE */
STEP4. Modifying make file
Write CY_USING_HAL in DEFINES at approximately line 104.
STEP5. Build and load
I use Terra Term.
If the terminal is set up correctly, the string stored in pringf will be displayed.
Finally,I have written main.c to output simple code that is easy to understand even for the beginning user.
In the future, I would like to try different codes using the printf function.
Thank you for reading this post.
Best Regards,
Show Less
Hi,
When we compared samples of the CY8C4124AXI-443T produced at different dates and factories, the differences detailed below were detected
In order to understand which of these differences in top marking and lead frames are correct, we need your official statements that we can use.
Reverse Logo colors, different alignment and size
TWNxxxx vs xxxx (There is no any Country Code. PHI or TWN)
Different Lead Frames (X-ray image)
Are there any official statements about these differences?
Show LessI am currently working in a power bank power delivery project and got CYPD72721-68LQXQ USB C PD controller. My circuit board is small , so to show status such as LED indicators or charging status etc I do not want to use an additonal MCU to handle these things. Can I use CYPD72721-68LQXQ for that purpose too?
Hi,
When we compared samples of the CY8C4124AXI-443T produced at different dates and factories, the differences detailed below were detected.
In order to understand which of these differences in top marking and lead frames are correct, we need your official statements that we can use.
Reverse Logo colors, different alignment and size
TWNxxxx vs xxxx (There is no any Country Code. PHI or TWN)
Different Lead Frames (X-ray image)
Are there any official statements about these differences?
Show Less
你好,我在SDK:Slavefifo5bit的范例中想要加多一个线程去供我做其他的功能,可是我是用了threadcreate之后我的usb设备就无法初始化了,请问是怎么回事呢??
I am using Application Kit TC3X7 V2.0 TFT board
I have configured BMHD but the board all the time boots from Internal flash ignoring BMHD settings
If i want to use Alternate Boot Mode or BMI to boot , which all changes i need to do on the board?
Show LessHello,
We are trying to flash binaries which has empty cells using Infineon MemTool (version 4.08.01) after the P-Flash erased.
But the Memtool programing the empty cells with all zreo values.
SW is checking that area has in erased state or not. So, SW is not working b'coz empty cells have values all zeros.
but other debugger flashing working with option: program empty cells "FALSE" setting
Please help us. if any setting required to do in Memtool
Show LessHi,
I want to translate the following App Note to Japanese. Please confirm to my work.
"Application note - MOTIX TLE987x Motor Control FOC Demo"
URL: https://www.infineon.com/dgdl/Infineon-MOTIX_TLE987x_Motor_Control_FOC_Demo_App_Note-ApplicationNotes-v01_00-EN.pdf?fileId=8ac78c8c8929aa4d0189441becff46d3
This application is large and will be divided into three parts.
I would like to translate pages 1 through 26 in this case.
Best Regards,
Hayashi.K
Hello Community,
I am started using TC233 development board for few days and i ant now to display a hello wolrd or messga in the Console but i didn' found how to do i tried also to display it on the putty but also it doesn't work.
is there any code exmaple or something that can help me.
Thank you
I inherited a project which uses a quite old version of the GCC toolchain when opening the project I receive the error:
Unable to find the tool chain with name: "ARM CM3-GCC 4.2.1". Select a different tool chain for your workspace.
How do I change the toolchain version of the project? I tried finding this version on the ARM developer project. The oldest version that I could find is 4.6 2012q4. Can someone point me to where to change the project settings or provide a link to the old version of the toolchain?
Show Less