cancel
Showing results for 
Search instead for 
Did you mean: 

printf and scanf functions is not working in stm cube IDE

RKUMA.2
Associate II

Hai,

I am using the printf and scan f functions in my code of stm cube IDE, when I want to print some messages on VIRTUAL COM port , but the messages are not showing in my serial monitor. I dont know why it is not working , is there we have to write an extra functions for printf and scanf functions in my code , how can i overcome this problem , actually I just want to print the user messages on COM port of serial monitor and also receiving the user entered data,

Thanks and Regards,

raj

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Raj!

When printf is called it typically calls the _write function. In the _write function you will need to implement where the I/O should be directed. By default the _write function does not send anything on the virtual com port. You'll find the _write function in the syscalls.c file.

If you would like a guide, you could try to google something along the lines of:

STM32 example virtual com port

View solution in original post

3 REPLIES 3
Ons KOOLI
Senior III

Hi @RKUMA.2​ ,

Can you please precise the MCU/Board you are working with ?

Best Regards,

Ons.

Hi @Ons KOOLI​  I am working on stm32f070c6 MCU , in that by using adc ,I want to measure the resistance of resistor connected at adc pin, by using simple ohms law ,but I am confuse with the how much current sinks at adc pin ,in datasheet page no. 58(The GPIOs (general purpose input/outputs) can sink or source up to +/-8 mA, and sink or source up to +/- 20 mA (with a relaxed VOL/VOH). In the user application, the number of I/O pins which) I'm confusing this points how much adc pin sink current for stm32f070c6 , i want to know the current(i) value voltage difference between adc and 3.3 gives the voltage(v) value ,by using ohms law i will find out the resistance(r) value connected at adc pin, I am facing another problem using stm cube IDE I am unable to use the printf or scanf functions, it doesn't print the user message to the serial monitor. please give the reply for above two queries

Thanks and Regards

RAJ

Hello Raj!

When printf is called it typically calls the _write function. In the _write function you will need to implement where the I/O should be directed. By default the _write function does not send anything on the virtual com port. You'll find the _write function in the syscalls.c file.

If you would like a guide, you could try to google something along the lines of:

STM32 example virtual com port