Arm Mbed OS support forum

How to port Software Serial to OS5 / 6?

I’m hoping someone may be able to help with guidance on how to port an OS2 library to OS5 / 6?

Software Serial
https://os.mbed.com/users/Sissors/code/SoftSerial/

use of undeclared identifier ‘us_ticker_read’, yet it appears to be still part of OS5. Along with how to replace the depreciated FunctionPoint to Callbacks?

Appreciate any help.

Thanks

Scott

Sorry, forgot to mention that I am using bare-metal profile which is probably why the us_ticker_read is not working… maybe

Hello,

topics below will give you more information about that, I think.
About FunctionPointer

About SoftSerial

BR, Jan

Ok, I’m getting there slowly but now have an issue which I hope someone will be able to help with. I’ve converted all of the FunctionPointers to CallBack<void()> and fixed the rx->fall. But now I get the error:

default constructor of ‘FlexTicker’ is implicitly deleted because base class ‘mbed::TimerEvent’ has no default constructor

Current code is in this repo:

Appreciate any help.

Thanks

Scott

Hi,
Please refer my test program.
I have updated it by TimerEvent constructor abolition.
https://os.mbed.com/users/kenjiArai/code/Check_TimerEvent_os5_15_3/
You can run FlexTicker similar function on OS6.

Thanks Kenji,

New problem now:

use of undeclared identifier ‘us_ticker_read’

What’s the OS5 / 6 way of reading the ticker value?

Hi,
my test program is using ‘us_ticker_read()’ without an error on OS6.8.0 & 6.9.0.
Please compile my program using online compiler.
If you still have a problem, please check your environment.

Hi Kenji,

I have successfully compiled your code locally with OS 6.9.0. However 5.15.3 fails to compile and also fails on the online compiler when switched to that version.

image

Target Device :: Nucleo-L432KC


Hi Kenji,

My target is the LPC1768. Any thoughts? OS5 is what I really need as OS6 causes other issues in my application.

Thanks

Scott

My LPC1768 board was broken.
I cannot run the test program but please add a below.

#include "mbed.h"
#include "us_ticker_api.h"

At least, error message is gone.

Thanks Kenji,

I’ve adapted SoftSerial with your fixes and it now compiles successfully on OS 5. Now to testing if it actually works. Greatly appreciate your time and help with this !!!

BR
Scott

Fails to work. As soon as transmit is initiated the board hard faults. Now how to figure that one out?

I cannot put a suggestion for your issue due to lack of the LPC1768 board.

Hello,

@scottalford LPC has 4 UARTs and 3/4 are available. So, why exactly you need SoftwareSerial?
I’m just curious.

BR, Jan

I am adding features to my soon to be released CNC firmware (Remora). For TMC2209 stepper drivers I need software serial to individually configure 5 of the drivers over standard IO.

I’ve had some success with an interrupt polled simple software serial. Hopefully it will work for what I need. Just need to convert it into a class now.

BR

Scott