Part Number: DSPI-3P-DSPVOIPCODECS
Tool/software:
Using code composer studio float to byte conversion is not supporting. The example is below The project settings for floating point support is fpu32.
Example 1:
uint8_t msg[4] = { 0x00, 0x40, 0x1C, 0x47 };uint8_t msg[4] = { 0x00, 0x40, 0x1C, 0x47 };
union {
char c[4];
float f;
} u;
u.c[3] = msg[3];
u.c[2] = msg[2];
u.c[1] = msg[1];
u.c[0] = msg[0];
printf("Float value: %f\n", u.f); // The expected float value is 40000. But the results is "0"
Exaple2:
union {
float f;
unsigned int i;
} data;
// Copy the bytes to the integer member of the union
data.i = (msg[3] << 24) | (msg[2] << 16) | (msg[1] << 8) | msg[0];
printf("Float value: %f\n", data.f);/ The expected float value is 40000. But the results is "0"
The same code working with visual studio is perfect. I mean the results are expected(40000)