I can't define an UnbufferedSerial port

i’m writing a code which allows me to have a serial communication but at the moment of compiler send me this message ‘Identifier “UnbufferedSerial” is undefined "static UnbufferedSerial serial_port(PB_6, PB_7);’
my code is based on the example of mbed tutorial page UnbufferedSerial - API references and tutorials | Mbed OS 6 Documentation


do you have correct version of MbedOS? The UnbufferedSeria is available only with MbedOS 6+.
Usually is also good to share informations about your target, used MbedOs and build Tool.

BR, Jan

i use compiler online.
I’m trying to get a serial communication for homework. something like a mirror with the stm32f103c8t6 and a USB-Serial converter which chip is CH340.
the idea of this program is send a character to the microcontroller and make an interruption in this to resend the same character.

Example of UnbufferedSerial with target Nucleo-F767ZI, under MbedOS 6.15 and Online Compiler… no problem occurred.

BR, Jan

my target is NUCLEO-F103RB.
i tried to change target to F767ZI but keep sending the same error number, which is 20.

For NUCLEO-F103RB is compilation also OK.

BR, Jan

how can i know the version?
and if i do not have the correct version, how can i update it?

Yellow gear icon with name mbed-os in your project → right click on it and select Update.
For current version use same like above but select Revisions instead of Update.

But simplest way for test is just visit the page what you posted above and import the UnbufferedSerial example via button Import into Mbed IDE.

BR, Jan

1 Like

thank you so much for the support.