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.

[参考译文] TMS570LC4357:如果 PHY 地址大于15,则在 Dp83640LinkStatusGet ()中出现问题

Guru**** 2461030 points
Other Parts Discussed in Thread: DP83640, HALCOGEN

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/655636/tms570lc4357-issue-in-dp83640linkstatusget-if-phy-address-is-greater-than-15

器件型号:TMS570LC4357
主题中讨论的其他器件:HALCOGENDP83640

您好!

当我尝试使用大于15的地址初始化 PHY (在我的案例中为17)时、HALCoGen 生成的 hL_phy_dp83640.c 代码(04.06和04.07/TI 和 GCC 模式)遇到问题。

此问题位于 Dp83640LinkStatusGet ()函数中。

易失性 uint16 linkStatus = 0U;

//检查 MDIO 链接寄存器是否已更新*/
linkStatus =(uint16) MDIOPhyLinkStatusGet (mdioBaseAddr);

/* SAFETYMCUSW 134 S MR:12.2 "LDRA 工具问题"*/
if ((linkStatus &(uint16)((uint16) 1U << phyAddr)!= 0U)
{
break;
}
else
{

} 

对 MDIOPhyLinkStatusGet ()的调用读取寄存器"PHY 链路状态寄存器(链路)"并返回 uint32值(其中16位 MSB 用于 PHY 地址介于16和31之间的器件的 MDIO 链路状态)。

函数 Dp83640LinkStatusGet ()然后将该值转换为 uint16,从而丢失地址超过15的任何 PHY 的 MDIO 链路状态位信息。 因此、后续测试失败、器件初始化中止。

我已修补代码以使用 uint32变量作为 MDIO 链路状态(与用于存储 DP86340基本模式状态寄存器(BMSR)内容的 uint16值不同)、器件初始化现在开始。

--- a/source/hal/hL_phy_phy_dp83640.c
++ b/source/hal/hL_phy_dp83640.c
@@-109,22+109,23 @@ boolean Dp83640LinkStatusGet (uint32 mdioBaseAddr、
uint32 phyAddr、
volatile uint32 retries)
{
- volatile uint16 linkStatus = 0U;
+ volatile uint16 phyBsr = 0U;
+ volatile uint32 linkStatus = 0U;
布尔值返回值= true;

while (RetVal == true)
{
/*首先读取 PHY 的 BSR */
- (空) MDIOPhyRegRead (mdioBaseAddr、phyAddr、(uint32) PHY_BSR、&linkStatus);
+ (void) MDIOPhyRegRead (mdioBaseAddr、phyAddr、(uint32) PHY_BSR、&phyBsr);

/*SAFETYMCUSW 134 S MR:12.2. "LDRA 工具问题"*/
- if ((linkStatus & PHY_LINK_STATUS)!= 0U)
+ if ((phyBsr & PHY_LINK_STATUS)!= 0U)
{
/*检查 MDIO 链接寄存器是否已更新*/
- 链接状态=(uint16) MDIOPhyLinkStatusGet (mdioBaseAddr);
+ 链接状态=(UINT32) MDIOPhyLinkStatusGet (mdioBaseAddr);

/*SAFETYMCUSW 134 S MR:12.2. "LDRA 工具问题"*/
- if ((linkStatus &(uint16)(uint16) 1U <<phyAddr)!= 0U
)+ if ((linkStatus &(uint32)((uint32) 1U <<phyAddr))!= 0U)
{
中断;
} 

此致、

Bastien Continouzas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Bastien、

    我将把它转发给我们的软件团队、以进行确认并进入我们的错误跟踪系统、以便在 HalCoGen 工具的下一个刷新周期对其进行修复。