Tool/software:
I'm getting a warning "warning #175-D: floating-point value does not fit in required integral type"
I am trying to update the EPWM TBPRD register, which is 16-bits as follows:
#define USER_EPWMCLK_FREQ_MHz 100000000
#define USER_TARGET_FREQ_kHz 200000
EPWM_setTimeBasePeriod(EPWM1_BASE, (uint16_t)(USER_EPWMCLK_FREQ_MHz / (USER_TARGET_FREQ_kHz * 1000) - 1));
Any suggestions on how to cast/reconfigure this to avoid the warning? I've tried a couple of variants with no success so far.
Thanks!
Looks like you are making some floating point operations that are resulting in numbers to large to represent as an uint16_t. Can you see if it makes sense to typecast the #defines prior to performing operations?
See this forum post for more information.
The end result should be "499", so there should be no problem with the end result being cast as a uint16_t.
As a work-around I am just hard-coding the 499, but I would like to get the macro working without warnings for future flexibility.
I am unable to reproduce the diagnostic ...
warning #175-D: floating-point value does not fit in required integral type
Please show the prototype for the function EPWM_setTimeBasePeriod. For the file being built when this diagnostic is emitted, please show the text of the compiler options. Copy them from the Console view in Code Composer Studio. Please copy and paste the text, and do not use any screenshots.
Thanks and regards,
-George
What is the version of the compiler (not CCS)?
Thanks and regards,
-George
Hello George,
The function prototype is static inline void
EPWM_setTimeBasePeriod(uint32_t base, uint16_t periodCount)
This is from C2000Ware_MotorControl_SDK_5_02_00_00\c2000ware\driverlib\f2837xd\driverlib\epwm.h
The build command and output are
Building file: "../epwm_setup.c"
Invoking: C2000 Compiler
"C:/ti/ccs1270/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --include_path="C:/ti/ccs1270/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --include_path="C:/workspace/Project Name --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/c2000ware/device_support/f2837xd/common/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/c2000ware/device_support/f2837xd/headers/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/c2000ware/driverlib/f2837xd/driverlib" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/libraries/transforms/ipark/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/libraries/transforms/svgen/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/libraries/utilities/angle_gen/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/libraries/utilities/types/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00/libraries/utilities/traj/include" --include_path="C:/ti/c2000/C2000Ware_MotorControl_SDK_5_02_00_00" --advice:performance=all --define=CPU1 --define=_LAUNCHXL_F28379D -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="epwm_setup.d_raw" "../epwm_setup.c"
"../epwm_setup.c", line 92: warning #175-D: floating-point value does not fit in required integral type
Finished building: "../epwm_setup.c"
The compiler version is v22.6.1.LTS
Unfortunately, I continue to be unable to reproduce the issue. For the source file epwm_setup.c, please follow the directions in the article How to Submit a Compiler Test Case.
Thanks and regards,
-George
Thanks for trying. I'll see if I can produce a test project that recreates the issue. It may be a week or so before I can get back to this issue, to do so.