Hello all.
I am trying to convert some bytes that I receive from CAN to a float variable.
However, the result is not correctly. I tried to change from little endian to big endian, not works.
For example, I am receiving the data 0x40333333, it`s suposed to be 2.8, but the result is totally different.
The images below will help to explain the situation (the variable that I am focusing in this example is cellParams.underVoltage
- variable initialiazion
cellParams.underVoltage = 2.80;
- initialization confirmation:

So after the initialization, I will send a CAN command to change the value (I will send the same value)
The new value is in the image below, from buffer position 3 until 6

When I receive the buffer, I try to do the following:
int dummyInt = DeserializeInt32(&cmdMsg->data[3]);
//cellParams.underVoltage = atof(&cmdMsg->data[3]); (same problem...)
cellParams.underVoltage = (float)(dummyInt);
static uint32_t DeserializeUint32(const uint8_t *buffer)
{
int value = 0;
value += (int)buffer[3] << 24U;
value += (int)buffer[2] << 16U;
value += (int)buffer[1] << 8U;
value += (int)buffer[0];
return value;
}
the returned value to dummyInt is OK:

The float value, before cellParams.underVoltage = (float)(dummyInt), is:

And after cellParams.underVoltage = (float)(dummyInt), is:

but if I check the variable (not in memory monitor), the hex value looks fine, but the float value lookw incorrect:

PS.: I tried atof, memcpy, not success.
Could someone help me? Thanks in advance!