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.
工具与软件:
尊敬的 TI 专家:
参考项目:UCD3138FW-BIDI
我在上面的 URL 中找到了有关此问题的相关信息、但尚未对其进行测试。
我还有几个问题需要确认、如下:
1.当我修改相应的 pflash 容量设置为64KB 时、函数调用 clear_integrity_word (0)后的参数是否应该进行相应调整?
或者是否应该修改"software_interrupt"案例12中的 zoiw_address 参数? 请提供准确的操作说明。
void rom_back_door(void) { // Call a SWI to clear the integrity words. clear_integrity_word(0); } //========================================================================================== // pmbus_write_rom_mode() // Erases the program integrity word in FLASH, then waits for watchdog timer to reset the // CPU. There is no return code or return from this function. //========================================================================================== int pmbus_write_rom_mode(void) { rom_back_door(); return PMBUS_SUCCESS; // Note: This line is never reached. }
2.使用 UCD3XXX GUI 工具进行编程时是否有任何具体注意事项? (例如:将闪存块复选框修改为"Block 0、1 64KB"?)
3.编程完成并重新上电后,从 ROM 切换到 pflash ,应该选择哪个选项?
谢谢。
您好 Parrish、
此致、
Jonathan Wong
尊敬的 Jonathan:
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;
您好 Parrish、
我将在星期一回复。 感谢您的耐心。
此致、
Jonathan Wong
您好 Parrish、
Fusion Digital Power Studio 用户指南 中的第5.2.1节介绍了如何配置 UCD3xxx 器件 GUI 以刷写多个块。
是的、是这样。 您可以在 interrupt.c 文件中更改 zojw_address = 0xfff8。
此致、
Jonathan Wong
尊敬的 Jonathan:
让我总结一下:
当修改.cmd 文件以将内存大小设置为64KB 时、案例12中的 zoj_address:if (arg1 = 0)也必须更新为 zoj_address = 0xfff8。
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; //=> need to change 0xfff8 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; } }
在刷写过程中、在 UCD3xxx 器件 GUI 中选择"Block 0、1 64KB"选项。
刷写后、要从 ROM 跳到 pflash、请选择默认 Block 选项。
是这样吗?
您好 Parrish、
是的、您的总结正确。
您是否要将存储器从4x 32kB 更改为2x 64kB 程序闪存? 如果是、则可能需要注释掉 if (arg1 = 2)和 if (arg1 = 3)案例、并在 if (arg1 = 1)中更改 zoj_address = 1fff8。
此致、
Jonathan Wong