This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Delfino F2837x floating point messaging over IPC

Other Parts Discussed in Thread: CONTROLSUITE

I'm working on an application that receives and stores various parameters in one core and passes those parameters over another core to use them in a control and monitoring application. Some of these parameters include floating point variables. Unfortunately, it doesn't seem that the IPC API included in the controlSuite supports floating point messaging.

I found an older post discussing the issue regarding a Concerto, but I can't seem to find an easy workaround that would suit my project's needs. I'm curious if there is anything out there that would solve this problem. It seems that being able to pass floating point values between cores that are both floating point enabled would be a fairly useful feature.

  • Sure, you can do that. All you need to do is convert the binary representation of the float to an integer:

    *(uint32_t *)&float_var

    Or if you'd rather not use the C99 stdint.h types:

    *(long *)&float_var

    You can pass the resulting value to API function or write it to an IPC register directly. This is a fairly standard method for doing unusual things with floating point values.

  • Thanks for getting back to me so fast. I wasn't sure if the compiler/linker behavior would be defined such that this is a safe thing to do. The topic regarding this issue on the Concerto threw me for a bit of a loop, as it made me think that perhaps not all TI compilers would accept this typecasting due to different byte-alignment assumptions. I do see that the code in that link was going about it a slightly different way.

    I've written some tests to verify that this will work for me without any precision loss or truncation, but I believe it will work okay.
  • My reading of the C28x compiler guide is that floats have to be aligned to even addresses, and all 32-bit function arguments are aligned to even addresses (or stored in ACC). So converting a float to a long int should always be safe, and converting a long int to a float should be safe if the long int is a function parameter. I don't think there are any guarantees about the alignment of a long int when it's a local variable, so you might need a helper function to convert one of those to a float.