cancel
Showing results for 
Search instead for 
Did you mean: 

Contradiction in SCP5 studio generated code (clock.h)

Yannek
Associate III

Hi,

In code generated by SPC5Studio for SPC582B microcontroller there are some macrodifinitions, which validate setting of the clock.

Particularily the one (components\spc582bxx_clock_component_rla\lib\include\clock.h):

/* Check ratio between SPC5_LIN_CLK and PBRIDGE_CLK.*/
#if (SPC5_LIN_CLK != 0U) && (SPC5_PBRIDGE_CLK < ((1UL * SPC5_LIN_CLK) / 3UL) || SPC5_PBRIDGE_CLK > ((2UL * SPC5_LIN_CLK) / 3UL))
#error "SPC5_LIN_CLK outside acceptable range (1/3 PBRIDGE_CLK...2/3 PBRIDGE_CLK)"
#endif

Due to the #if equation - LIN_CLK must be 2 times bigger than PBRIDGE_CLK.

But due to #error comment - LIN_CLK acceptable value is half of PBRIDGE_CLK (between 1/3 and 2/3 of PBRIDGE_CLK actually).

Which one is correct?

Best,

Yannek

1 ACCEPTED SOLUTION

Accepted Solutions
Giuseppe DI-GIORE
ST Employee

Hello,

actually the relationship is correct while the comment is wrong.

Reference Manual says: "The relationship “(2/3)* LIN_CLK > PBRIDGEx_CLK > 1/3*LIN_CLK�? should be maintained"

Regards,

Giuseppe

View solution in original post

2 REPLIES 2
Erwan YVIN
ST Employee

Yes , the error comment does not match with the if

i am submitting a ER

Best regards

Erwan

Giuseppe DI-GIORE
ST Employee

Hello,

actually the relationship is correct while the comment is wrong.

Reference Manual says: "The relationship “(2/3)* LIN_CLK > PBRIDGEx_CLK > 1/3*LIN_CLK�? should be maintained"

Regards,

Giuseppe