Skip to main content
Yannek
Associate III
July 24, 2020
Solved

Contradiction in SCP5 studio generated code (clock.h)

  • July 24, 2020
  • 2 replies
  • 1067 views

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

    This topic has been closed for replies.
    Best answer by Giuseppe DI-GIORE

    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

    2 replies

    Erwan YVIN
    ST Employee
    August 18, 2020

    Yes , the error comment does not match with the if

    i am submitting a ER

    Best regards

    Erwan

    Giuseppe DI-GIORE
    ST Employee
    January 12, 2021

    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