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.
Tool/software:
Dear TI Experts,
Reference project: UCD3138FW-BIDI
I have found related information regarding this issue at the URL above but have not tested it yet.
I still have a few questions to confirm, as follows:
1. When I modify the corresponding PFlash capacity setting to 64KB, should the parameter following the function call clear_integrity_word(0); also be adjusted accordingly?
Or should the zoiw_address parameter in the "software_interrupt" case 12 be modified? Please provide accurate instructions for the operation.
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. Are there any specific considerations when programming with the UCD3XXX GUI Tool? (For example: modifying the Flash block checkbox to "Block 0,1 64KB"?)
3. After programming is complete and power is cycled, to switch from ROM to PFlash, which option should be selected?
Thanks.
Hello Parrish,
Regards,
Jonathan Wong
Dear 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;
Hello Parrish,
I will provide a response on Monday. Thank you for your patience.
Regards,
Jonathan Wong
Hello Parrish,
Section 5.2.1 on the Fusion Digital Power Studio User's Guide has information on how to configure the UCD3xxx Device GUI for flashing multiple blocks.
Yes, that would be correct. You can change the zoiw_address = 0xfff8 in the interrupt.c file.
Regards,
Jonathan Wong
Dear Jonathan,
Let me summarize:
When modifying the .cmd file to set the memory size to 64KB, the zoiw_address in case12: if(arg1 == 0) must also be updated to zoiw_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; } }
During the flashing process, select the "Block 0,1 64kB" option in the UCD3xxx Device GUI.
After flashing, to jump from ROM to PFlash, select the default Block option.
Is this correct?
Hello Parrish,
Yes, your summary is correct.
Are you changing the memory from 4x 32kB to 2x 64kB program flashes? If so, then you may want to comment out the if(arg1 == 2) and if(arg1 == 3) cases and, in if(arg1 == 1), change zoiw_address = 1fff8.
Regards,
Jonathan Wong