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.

[参考译文] CC2642R:闪存写入缺少部分

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1584294/cc2642r-flash-write-missing-portions

器件型号: CC2642R

我正在开发一个具有固件更新功能的自定义引导加载程序、因此需要直接写入闪存。 在测试过程中、我发现闪存的一些小部分(~256 字节或更小)未按预期更新、而是保留它们的旧值。 该故障是间歇性的、每次尝试时错过的地址都会发生更改。在第一次尝试更新时、我经常观察到多个失败的部分、但第二次写入操作会纠正这些部分并产生有效的固件映像。

更新过程必须进行多次写入才能更新单个闪存扇区。 目标地址复制到 RAM 前后的扇区内容、擦除该扇区、并将缓冲副本与新数据一同写回。 这种复制过程可能存在错误、但在其他地方经过了良好测试、并且故障的随机性质表明低级闪存写入和擦除本身存在问题。

以下是我的闪存写入和擦除函数。 我已按照手册 VIMS 部分中的说明禁用了闪存缓存、行缓冲区和中断。 安全操作闪存是否缺少任何其他规定或保护措施?

static uint32_t _Flash_Updater_eraseSegment(uintptr_t segmentAddr)
{
    uint32_t err;


    unsigned int key = _disable_interrupts();
    err = FlashSectorErase(segmentAddr);
    _restore_interrupts(key);

    return err;
}

static uint32_t _Flash_Updater_directWrite(uintptr_t dstAddr, const void *pSrc,
        uint16_t size)
{
    uint32_t err;
    uint8_t *pByte = (uint8_t *) pSrc;

    // Disable cache and line buffer (see VIMS section 8.3 of TRM).
    unsigned int key = _disable_interrupts();
    VIMSModeSafeSet(VIMS_BASE, VIMS_MODE_OFF, 1);
    VIMSLineBufDisable(VIMS_BASE);
    err = FlashProgram(pByte, dstAddr, size);
    // Re-enable cache and line buffer.
    VIMSModeSafeSet(VIMS_BASE, VIMS_MODE_ENABLED, 1);
    VIMSLineBufEnable(VIMS_BASE);
    _restore_interrupts(key);

    return err;
}

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

    您好、Nick、

    的内部引用了闪存擦除和编程操作

    \source\ti\common\cc26xx\flash_interface\internal\flash_interface_internal.c
    \source\ti\ble5stack\osal\webc\cc26xx\osal_snv.c src

    这包括检查适当的电压电平(可选)、进入/退出关键部分、禁用/启用高速缓存以及检查 driverlib 命令的返回状态。 还有其他例程、例如等待缓存禁用完成、这在您的解决方案中可能不常见。   如果您担心引导加载程序内存分配、可以使用 ROM driverlib 函数。  在写入这些页面之前、您是否已确保擦除完成?

    此致、
    Ryan