Arm Mbed OS support forum

BufferedSerial doesn't compile with Online Compiler

Hello,
I was trying to compile:

https://os.mbed.com/compiler/#import:https://github.com/ARMmbed/mbed-os-snippet-BufferedSerial_echo

using Online Compiler for LPC1768.
I am getting:
Error: Unknown type name ‘BufferedSerial’ in “main.cpp”, Line: 15, Col: 8

I was trying to use mbed OS6. Why won’t it compile?
Pramod

I can agree that (Online compiler with Nucleo-F767ZI)

  • revision 9a8c9e2 - same error
  • revision 8b095603a - same error
  • revision 165be79392 - no issue
  • revision 5daad96eb7 - same error
  • revision 1b2a68ae20 - same error

I have the same problem, using target NRF52840-DK

HI all,

looks like you need to add
#include “BufferedSerial.h”

underneath the mbed.h include. I’ll get our docs team to udpate the example .

Regards
Anna

Interestingly this compiles fine without changes using the offline mbed cli tool! I’m going to have a chat with our online compiler team. But including the header as stated above will work in the interim.

Hi Anna,

Also with both versions (online and desktop) of MbedStudio it is compiled fine and without including the header- MbedOS 6.1 Commit: a6207cadad0acd1876f436dc6baeddf46c42af06
The issue occur only with the Online compiler and it doesn’t matter what commit I use, from latests.

I have no luck with the solution (include the header) what you mentioned.
BTW same is for both new Serial APIs (UnbufferedSerial / BufferedSerial).

Thank you for your time.
BR, Jan

Hi Johnny

I’m investigating with the tools / online compiler team to try and get to the bottom of the issue. I’ll provide an update once we work out what the problem is.

Anna

1 Like

Hi all,

I’ve further investigated and had discussions with the tools team.
The online IDE was primarily designed for pre-6.0 versions of mbed-os. This means that additional steps may be required in order to get some of the 6.x based examples to work.

Please try the following steps:

  1. Import example
  2. When the pop up window appears, check the ‘update all libraries to latest versions’ and import
  3. Once the example has loaded , click on the project name, then select ‘revisions’ from the toolbar
  4. When the revision list comes up, highlight the version you wish to use (latest being v6.1 branch) and then click ‘switch’ from the toolbar

It should now compile.

Regards
Anna

Thank you Anna, it now works.

Hello,
How do I set “SERIAL_RESERVED_CHAR_MATCH” in BufferedSerial.

int read (uint8_t *buffer, int length, const event_callback_t &callback, int event=SERIAL_EVENT_RX_COMPLETE, unsigned char char_match=SERIAL_RESERVED_CHAR_MATCH)

1 Like

I’m not sure I understand the question. What exactly are you trying to do ?

Hello,
I was wondering if " SERIAL_RESERVED_CHAR_MATCH" would give me the same functionality of MODSERIAL as in serialport.autoDetectChar(’\r’);
BR
Pramod

I used circular serial to store and compare string received from UART port.
I have compiled and tested on my board NUCLEO ,with online MBED platform

Here is the link :

https://os.mbed.com/users/radhey04ec/code/19_RAWSERIAL_UART_RECEIVE/

Hopefully this example help you

1 Like

Hi @radhey04ec,

Thank you, you share your example. But the RawSerial is deprecated in the MbedOS 6 and was removed. So if you want to use latest MbedOS, the RawSerial is not recommanded.
You can found that at end of APIs list or in the release note for the MbedOS 6.

This topic is about the issue around the new APIs (UnbufferedSerial/BufferedSerial) what are not usable in some revisions. How was wrote above, that was caused because MbedOS6 was released but Mbed tools were not 100% ready for it or something like that.
BR, Jan

Hello,

It seems to compile OK with the latest Mbed OS 6.2.0.
But be aware that there is an issue with the online compiler when updating the mbed-os library.
So update manually! For those who never done it before:

  • Right-click on the mbed-os library in your project and select Revisions...
  • Click on the last revision (‘tag: mbed-os-6.2.0’) and click on the Switch button (on the toolbar).

Best regards, Zoltan

1 Like

Hello Jaydeep,
Thanks for responding, but my issue was whether BufferedSerial in OS6.x supports SERIAL_RESERVED_CHAR_MATCH, this feature is available in MODSERIAL.
MODSERIAL does not comile in OS6.x hence my issue.
Thanks all the same
Pramod

Also trying to compile

https://os.mbed.com/compiler/#import:https://github.com/ARMmbed/mbed-os-snippet-BufferedSerial_echo

using the Online Compiler for the FRDM-KL25Z.
The line
static BufferedSerial serial_port(USBTX, USBRX);
produces
Error: Unknown type name ‘BufferedSerial’ in “main.cpp”, Line: 15, Col: 8

I have updated mbed-os to 6.3.0

What is the problem? It seems odd that a basic, frequently used API is broken. Hopefully, someone can help.

Hello Peter,

please see this topic and try to verify it with add followed code

printf(" MbedOS v %d.%d.%d\r\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);

You probably will see MbedOS 5 .15

I solved that with downgrade to the MbedOS 6.2.1, until it will be solved.

BR, Jan

1 Like

Thanks Jan,

Downgrade to MbedOS 6.2.1 worked and the example code compiled.

Regards,
Peter