The code in the reception section is problematic. You copy bytes into receiveds
and then use pointer conversions to treat it as a float
. However, many C implementations use one-byte alignment for character/byte types (as receiveds
likely is) and four-byte alignment for float
types. Converting a uint8
pointer to a float
pointer may result in a pointer with improper alignment.
Instead, you can do this:
float received;
… // Code that prepares receiveds goes here.
memcpy(&received, receiveds, sizeof received);
Additionally, if pData->dataInd.msdu.p
is an array of or a pointer to bytes (char
, unsigned char
, or, likely, uint8
and uint8
is a character type in your C implementation), then you can omit using receiveds
as an intermediate buffer and just copy directly:
float received;
// Omit the code that copied into receiveds.
memcpy(&received, pData->dataInd.msdu.p, sizeof received);
If that does not resolve the issue, then examine the actual bytes being copied into the send buffer and the bytes being copied from the receive buffer and ensure they are the same.