主题中讨论的其他器件:、 UCD3138064
工具与软件:
我将编写一些代码、以允许通过串行端口对 UCD3138128A 进行编程。
我的问题是
要使启动代码识别块2和3中的映像、需要做些什么才能在启动时也进行切换。
然后... 当我使用较新的映像对这些块进行编程时、如何使其再次切换到块0和1?
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.
工具与软件:
我将编写一些代码、以允许通过串行端口对 UCD3138128A 进行编程。
我的问题是
要使启动代码识别块2和3中的映像、需要做些什么才能在启动时也进行切换。
然后... 当我使用较新的映像对这些块进行编程时、如何使其再次切换到块0和1?
你好、蝙蝠侠:
UCD3138FW-BIDI 有一个清除 UCD3138128上的块0 - 3的示例。
main.c 在 BIDIRECTION_DC-UCD3138128中具有 clear_integrity_words() (第110行)基于参数清除块0 - 3的函数。
#if (UCD3138128 ) #ifdef MEMORY_SCRUBBING clear_integrity_word(1); // erase 8-byte checksum @ end of pflash block 1 //clear_integrity_word(3); // erase 8-byte checksum @ end of pflash block 3 reset_uP(); #else clear_integrity_word(0); #endif
software_interrupt_wrapper.c 显示 clear_integrity_words()触发软件中断情况12 (第95行)。
void clear_integrity_word(Uint32 block) { swi_single_entry(block,0,0,12); }
interrupts.c 包含软件中断处理程序。 In 案例12. (第163行)、代码通过清除相应的用户校验和来清除编程闪存块。
case 12: // clear integrity words, depending on arg1 #if (UCD3138128) //Note: This clear integrity word covers all cases. It is designed to clear integrity words based on what address the flash block is //mapped to when it is called. This is done for code which switches blocks. And it can erase the integrity word at the end of each of 4 blocks. // //For most applications, it can be simplified considerably if code space is scarce // // { register Uint32 * program_index = (Uint32 *) program_area; //store destination address for program register Uint32 * source_index = (Uint32 *) zero_out_integrity_double_word; //Used for source address of PFLASH; register Uint32 counter; if(arg1 == 0) //0 means first block in memory, regardless of which block that is; { zoiw_address = 0x7ff8; if((DecRegs.MFBALR1.bit.ADDRESS == 0) && (DecRegs.MFBAHR1.bit.ADDRESS == 0)) //here if flash block 0 is at 0 { zoiw_flash_key = PROGRAM_FLASH0_INTERLOCK_KEY; } else if((DecRegs.MFBALR17.bit.ADDRESS == 0) && (DecRegs.MFBAHR17.bit.ADDRESS == 0))//if it's program flash 1; { zoiw_flash_key = PROGRAM_FLASH1_INTERLOCK_KEY; } else if((DecRegs.MFBALR18.bit.ADDRESS == 0) && (DecRegs.MFBAHR18.bit.ADDRESS == 0))//if it's program flash 2; { zoiw_flash_key = PROGRAM_FLASH2_INTERLOCK_KEY; } else if((DecRegs.MFBALR19.bit.ADDRESS == 0) && (DecRegs.MFBAHR19.bit.ADDRESS == 0))//if it's program flash 3; { zoiw_flash_key = PROGRAM_FLASH3_INTERLOCK_KEY; } else { return; } } else if(arg1 == 1)//1 means end of second block; { zoiw_address = 0xfff8; if((DecRegs.MFBALR1.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR1.bit.ADDRESS == 0)) //here if flash block 0 is at 0x8000 //note that the address bits start at bit 10, so 0x20 in the address field equals 0x8000 { zoiw_flash_key = PROGRAM_FLASH0_INTERLOCK_KEY; } else if((DecRegs.MFBALR17.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR17.bit.ADDRESS == 0))//if it's program flash 1; { zoiw_flash_key = PROGRAM_FLASH1_INTERLOCK_KEY; } else if((DecRegs.MFBALR18.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR18.bit.ADDRESS == 0))//if it's program flash 2; { zoiw_flash_key = PROGRAM_FLASH2_INTERLOCK_KEY; } else if((DecRegs.MFBALR19.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR19.bit.ADDRESS == 0))//if it's program flash 3; { zoiw_flash_key = PROGRAM_FLASH3_INTERLOCK_KEY; } else { return; } } else if(arg1 == 2) //2 means end of third block in memory, regardless of which block that is; { zoiw_address = 0x17ff8; if((DecRegs.MFBALR1.bit.ADDRESS == 0) && (DecRegs.MFBAHR1.bit.ADDRESS == 1)) //here if flash block 0 is at 0x10000 { zoiw_flash_key = PROGRAM_FLASH0_INTERLOCK_KEY; } else if((DecRegs.MFBALR17.bit.ADDRESS == 0) && (DecRegs.MFBAHR17.bit.ADDRESS == 1))//if it's program flash 1; { zoiw_flash_key = PROGRAM_FLASH1_INTERLOCK_KEY; } else if((DecRegs.MFBALR18.bit.ADDRESS == 0) && (DecRegs.MFBAHR18.bit.ADDRESS == 1))//if it's program flash 2; { zoiw_flash_key = PROGRAM_FLASH2_INTERLOCK_KEY; } else if((DecRegs.MFBALR19.bit.ADDRESS == 0) && (DecRegs.MFBAHR19.bit.ADDRESS == 1))//if it's program flash 3; { zoiw_flash_key = PROGRAM_FLASH3_INTERLOCK_KEY; } else { return; } } else if(arg1 == 3)//2 means end of fourth block; { zoiw_address = 0x1fff8; if((DecRegs.MFBALR1.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR1.bit.ADDRESS == 1)) //here if flash block 0 is at 0x18000 //note that the address bits start at bit 10, so 0x20 in the address field equals 0x8000 { zoiw_flash_key = PROGRAM_FLASH0_INTERLOCK_KEY; } else if((DecRegs.MFBALR17.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR17.bit.ADDRESS == 1))//if it's program flash 1; { zoiw_flash_key = PROGRAM_FLASH1_INTERLOCK_KEY; } else if((DecRegs.MFBALR18.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR18.bit.ADDRESS == 1))//if it's program flash 2; { zoiw_flash_key = PROGRAM_FLASH2_INTERLOCK_KEY; } else if((DecRegs.MFBALR19.bit.ADDRESS == 0x20) && (DecRegs.MFBAHR19.bit.ADDRESS == 1))//if it's program flash 3; { zoiw_flash_key = PROGRAM_FLASH3_INTERLOCK_KEY; } else { return; } } else { return; //reject other arg1 values } for(counter=0; counter < 32; counter++) //Copy program from PFLASH to RAM { *(program_index++)=*(source_index++); } DecRegs.MFBALR1.bit.RONLY = 0; //enable program flash 1 write DecRegs.MFBALR17.bit.RONLY = 0; //enable program flash 2 write { register FUNC_PTR func_ptr; func_ptr=(FUNC_PTR)program_area; //Set function to program area func_ptr(); } //execute erase checksum DecRegs.MFBALR1.bit.RONLY = 1; //restore it to read only DecRegs.MFBALR17.bit.RONLY = 1; //restore it to read only SysRegs.SYSECR.bit.RESET = 2; //now reset processor. break; }
用户校验和地址 基于 UCD31xx TRM 第469页的。 请参阅表以直观查看程序闪存和用户校验和地址的概述。
您可以使用这些地址清除和切换不同的程序闪存块。
我认为、您用于在程序闪存块之间进行切换的应用仅用于动态更新。 如果是、我们确实提供了我可以共享的动态更新固件示例、尽管该固件适用于 UCD3138064而不是 UCD3138128A。 如果您有兴趣、请告诉我、我可以直接向您发送文件。
以下是介绍一般动态/无线(OTA)更新的文章: https://www.electronicproducts.com/on-the-fly-power-supply-firmware-upgrades/?terms=Ian+Bower
e2e.ti.com/.../On_2D00_the_2D00_fly-power-supply-firmware-upgrades.docx
下面是一些其他可能有用的 E2E 主题:
此致、
Jonathan Wong