I'm wondering how the protocol intends to avoid running into the deadlock described above. From what it looks like there is no mechanism that prevents that situation.
Thanks!
mabraun
edit: tried to make problem description more comprehensive
I fully understand the reason for using dynamic memory allocation, it makes sense with a variable number of packets and a variable PAR_LEN field value. However I would like to know if static memory allocation is a viable option (and achievable looking at memory requirements). In this case I would like to know what the max value for PAR_LEN is (the maximum number of bytes of Parameters that a message can contain) and how many packets / messages could potentially be sent by the DA14580. If feasible, I could create a circular buffer of X number of packets, each with MAX_PAR_LEN bytes of Parameters (we have 32kB of RAM available in total, so for example 3 packets of each 350 bytes with a separate read buffer of 350 bytes and a write buffer of 350 bytes (for asynchronous reading/writing) is not very realistic).
I would love to hear your thoughts on this. If at all possible, I would rather not use malloc / free.
Kind regards,
Arjan
Edit 02-11-2015
I have added information regarding endianness and data structure padding below, perhaps other forum users might find this useful as well.