Arm Mbed OS support forum

Board to board UART serial communication

Hi,
I’m developing board to board send and receive data packet over UART using buffered serial. But written serial value doesn’t receive from receiver side. Can some one guide me how to write the code and how the Packet structure (starting bit 55aa )looks like.
my read and write functions are like this.

void write(const byte* data, unsigned size)
        {
            m_serial.write(&data,size);
        }
        void read(byte* data,unsigned size)
        {
            m_serial.read(&data,size);
            
        }
        template<typename T>
        void write(const T& data)
        {
            write(reinterpret_cast<const byte*>(&data),sizeof(T));
        }   
        template<typename T>
        void read(T& data)
        {
            read(reinterpret_cast<byte*>(&data),sizeof(T));
        }

HI,
there is example code in the docs:
Full API list - API references and tutorials | Mbed OS 6 Documentation (scroll to Drivers section).

Hope that helps.
Anna