I have a device based on stm32 microcontroller. I need an implementation of the communication protocol stack in the firmware of the device. I had several options for implementing this, but I was not satisfied with my result. It's binary protocol.
If we look at the OSI model, I need an implementation of the transport and presentation layers. I can't understand and find the right way.
- How to dampen and translate data through stack layers. Whether to use a damping buffer on all layers, or use one buffer for all layers.
- How to make the right API at every level. Do I need to have an additional function in the API on adjacent layers, or do I need to use a link function to communicate between layers.
I saw tcp/ip stack realization, but it complexity and I can not uderstand on 100%.
I need understand pattern for this task.
Thanks.