Skip to main content
Pratyush
Associate II
June 16, 2022
Question

How to print any variable value in the external serial monitor through FTDI using STM32F0308-DISCO board. I have tried the UART example to do that only message can be print but not the values of any variable. How to do that please share your thoughts

  • June 16, 2022
  • 3 replies
  • 3425 views

..

This topic has been closed for replies.

3 replies

gbm
Principal
June 16, 2022

That's quite common and basic thing. Search for "STM32 printf redirection". See the syscalls.c file generated by CubeIDE.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Pratyush
PratyushAuthor
Associate II
June 18, 2022

Hello,

thanks for your reply, i am new to stm so i followed some debugging tutorial and i have tried but no luck, this is the link which i have followed.

"https://www.youtube.com/watch?v=-X8tndfqTu8&list=PL7tUZeMaichqrlJN4PGu3-n6DbYrvoG-s&index=4"

so i need a debugging console which should print the value which i mentioned.

please help me to resolve this .

Andrew Neil
Super User
June 16, 2022

"only message can be print but not the values of any variable"

What do you mean by that?

If you can print "messages", then you must have the basic output working, surely?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
June 16, 2022

In what form? Human/ASCII?

char string[16];

int i = 12345;

HAL_UART_Transmit(hUART, (uint8_t *)string, sprintf(string, "%d", i), 1000);

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Pratyush
PratyushAuthor
Associate II
June 18, 2022

Hello,

Thanks for the reply,

I want to print the variable data in the IDE debugger i mean SWV CONSOLE so i have tried the way which is mentioned in the tutorial link

"https://www.youtube.com/watch?v=-X8tndfqTu8&list=PL7tUZeMaichqrlJN4PGu3-n6DbYrvoG-s&index=4"

now i am using STM32446RET6 custom board and for this i have used ST-LINK as a STM32F0308-DISCO by removing CN2 connectors.

still i didn't get any data in the console please help to resolve this.

thank you.

Andrew Neil
Super User
June 20, 2022

@Pratyush​ "still i didn't get any data in the console"

Nothing at all?

But you said you were getting "messages" (you still haven't explained what you meant by that) - are you saying that even that has now stopped?

You also didn't answer the question from @Community member​  - are you trying to send in human-readable (ASCII) text form, or as binary?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.