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.

[参考译文] MSP432E401Y:以太网初始化超时(电缆未插入)会导致闪存预取暂时禁用、启动后~10分钟

Guru**** 2535750 points
Other Parts Discussed in Thread: MSP432E401Y

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1266881/msp432e401y-ethernet-init-timeout-cable-not-plugged-in-causes-flash-prefetch-to-be-temporarily-disabled-10mins-after-boot

器件型号:MSP432E401Y

您好、TI!

我们的 MSP432E401Y 应用具有零延迟中断、消耗约50%的处理能力。

当关闭闪存预取功能时、这会增加到超过100%的处理器时间、从而使 RTOS 无法完全启动、因此无法重新开启闪存预取功能。

SYSCFG 会自动生成 ti_ndk_config.c、后者会在失败时尝试重新启动网络栈:

    /*  Boot the system using this configuration
     *
     *  Loop until the function returns 0. This facilitates a reboot command.
     */
    do
    {
        rc = NC_NetStart(hCfg, NULL, NULL, netIPAddrHook);

        /* user reboot hook == null */

    } while (rc > 0);

这最终会调用 EMACMSP432E.c:

static int EMACMSP432E4_emacStart(struct NETIF_DEVICE* ptr_net_device)
{
    ...

    key = HwiP_disable();

    /*
     *  This is a work-around for the EMAC initialization issue found
     *  on the TM4C129 devices. This can be found in the silicon errata
     *  documentation spmz850g.pdf as ETH#02.
     *
     *  The following disables the flash pre-fetch (if it is not already
     *  disabled).
     */
    ui32FlashConf = FLASH_CTRL->CONF;
    if ((ui32FlashConf & (FLASH_CONF_FPFOFF)) == false) {
        enablePrefetch = true;
        ui32FlashConf &= ~(FLASH_CONF_FPFON);
        ui32FlashConf |= FLASH_CONF_FPFOFF;
        FLASH_CTRL->CONF = ui32FlashConf;
    }

    EMACPHYConfigSet(EMAC0_BASE, EMAC_PHY_CONFIG);
    
    ...
}

我看不到使用当前 NDK 和 SYSCFG 关闭闪存预取的方法。

据我所料、我唯一变通办法的机会是从 RAM 运行零延迟中断。 从 RAM 执行的速度是否与预取的闪存一样快?

在这里、您能否提供一个不触发闪存预取禁用的解决方案?

谢谢。

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

    您好!

     抱歉、我目前在一周的剩余时间度假、无法访问我的 PC 来读取源文件。 我认为应该在初始化后再次重新启用闪存预取。 您可以在注册浏览器中检查注册吗? 它是 已禁用还是未再次启用?  

     虽然可以在 RAM 之外运行代码、但我们应该了解为什么未启用闪存预取。 是的、RAM 是120MHz 的单周期存取存储器。

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

    是的、它会重新开启预取。 遗憾的是、我们的零延迟中断(在预取功能关闭的情况下从闪存运行时)会消耗所有处理器时间、因此 RTOS 没有机会重新开启。 无论如何、我们的应用此时已经过了。 我们每23us 中使用大约11us。 禁用预取会将速度减慢约2.7倍。

    对于任何有兴趣的人来说、从 RAM 运行都特别简单:只需在"void MyInterrupt (void){"之前添加"__attribute__((ramfunc))"。 您可能需要将"   .binit :  > flash"添加到链接器文件中。 这解决了我们眼前的问题。

    我同意、关闭预取非常重要。 这篇文章 https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/916178/msp432e401y-does-errata-eth-02-exist-in-msp432e-devices 提出了这个问题,但没有答案。 可能是在 wiki 中?

    想象一下、我提出的以太网外设设置是由 DMA 完成的、对于外设来说写入速度太快。 在本例中、RAM 权变措施的作用在于 DMA 仍然很慢地从闪存中获取内容、但我们的中断以全速运行。

    但是、如果外设需要通过 RAM 快速执行 DMAED、而关闭预取是从 CPU 获取总线时间的一种方法、RAM 权变措施将会使其中断。 我们可以这样做、因为用户能够在方便的时候进行下电上电以使以太网端口再次打开、而不是我们的器件每10分钟崩溃一次。

    如果事实证明从 RAM 执行任何内容都可能破坏以太网功能、那么这会非常愚蠢。