/**************************************************************************** **************************************************************************** Program5554 : ****************************************************************************/ static BDI_InitTypeT initList5554[] = { {BDI_INIT_P55_WSPR, 8007, 100}, // Wake-up delay 100 ms {BDI_INIT_P55_WSPR, 8004, 1}, // Select memroy access via Nexus {BDI_INIT_P55_WTLB, 0xFFF0058A, 0xFFF0003F}, // Bridge B: 0xfff00000 -> 0xfff00000, 1MB, --I-G- {BDI_INIT_P55_WTLB, 0xC3F0058A, 0xC3F0003F}, // Bridge A: 0xc3f00000 -> 0xc3f00000, 1MB, --I-G- {BDI_INIT_P55_WTLB, 0x4000048A, 0x4000003F}, // Int.SRAM: 0x40000000 -> 0x40000000, 256KB, --I-G- {BDI_INIT_P55_WTLB, 0x0000078A, 0x0000003F}, // Flash : 0x00000000 -> 0x00000000, 16MB, --I-G- {BDI_INIT_P55_FILL, 0x40000000, 0x10000 }, // init ECC-SRAM {BDI_INIT_P55_WM32, 0xC3F80000, 0x01000000}, // FMPLL_SYNCR: MFD=2,RFD=0 -> fsys = 48MHz // Lock/Unlock Flash Blocks for Erase/Programming {BDI_INIT_P55_WM32, 0xC3F88004, 0xA1A11111}, // FLASH_LMLR : unlock register {BDI_INIT_P55_WM32, 0xC3F88004, 0x001CFFFF}, // FLASH_LMLR : lock/unlock blocks {BDI_INIT_P55_WM32, 0xC3F8800C, 0xC3C33333}, // FLASH_SLMLR: unlock register {BDI_INIT_P55_WM32, 0xC3F8800C, 0x001CFFFF}, // FLASH_SLMLR: lock/unlock blocks {BDI_INIT_P55_WM32, 0xC3F88008, 0xB2B22222}, // FLASH_HLR : unlock register {BDI_INIT_P55_WM32, 0xC3F88008, 0x0FFFFFF0}, // FLASH_HLR : lock/unlock blocks }; static int Program5554(void) { int result; DWORD errorAddr; /* reset and init target */ result = BDI_TargetStartup(100, // 100ms reset time (0<<8) | 3, // MPC5554, 8 MHz JTAG clock sizeof initList5554 / sizeof initList5554[0], initList5554); /* setup flash programming */ result = BDI_FlashSetType(BDI_FLASH_H7F, 0x80000, 32, // MPC5554 has 32 byte page size 32, 0x40001000); if (result != BDI_OKAY) return result; /* erase flash */ printf("erasing ... "); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_MID, 0x00000003); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_HIGH, 0x0000000F); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("programming..."); result = BDI_FlashWriteBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("verifing... "); result = BDI_VerifyBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf("passed\n"); return result; } /* Program5554 */ /**************************************************************************** **************************************************************************** Program5534 : ****************************************************************************/ static BDI_InitTypeT initList5534[] = { {BDI_INIT_P55_WSPR, 8007, 100}, // Wake-up delay 100 ms {BDI_INIT_P55_WSPR, 8004, 1}, // Select memroy access via Nexus {BDI_INIT_P55_WTLB, 0xFFF0058A, 0xFFF0003F}, // Bridge B: 0xfff00000 -> 0xfff00000, 1MB, --I-G- {BDI_INIT_P55_WTLB, 0xC3F0058A, 0xC3F0003F}, // Bridge A: 0xc3f00000 -> 0xc3f00000, 1MB, --I-G- {BDI_INIT_P55_WTLB, 0x4000048A, 0x4000003F}, // Int.SRAM: 0x40000000 -> 0x40000000, 256KB, --I-G- {BDI_INIT_P55_WTLB, 0x0000078A, 0x0000003F}, // Flash : 0x00000000 -> 0x00000000, 16MB, --I-G- {BDI_INIT_P55_FILL, 0x40000000, 0x10000 }, // init ECC-SRAM {BDI_INIT_P55_WM32, 0xC3F80000, 0x01000000}, // FMPLL_SYNCR: MFD=2,RFD=0 -> fsys = 48MHz // Lock/Unlock Flash Blocks for Erase/Programming {BDI_INIT_P55_WM32, 0xC3F88004, 0xA1A11111}, // FLASH_LMLR : unlock register {BDI_INIT_P55_WM32, 0xC3F88004, 0x001CFFFF}, // FLASH_LMLR : lock/unlock blocks {BDI_INIT_P55_WM32, 0xC3F8800C, 0xC3C33333}, // FLASH_SLMLR: unlock register {BDI_INIT_P55_WM32, 0xC3F8800C, 0x001CFFFF}, // FLASH_SLMLR: lock/unlock blocks {BDI_INIT_P55_WM32, 0xC3F88008, 0xB2B22222}, // FLASH_HLR : unlock register {BDI_INIT_P55_WM32, 0xC3F88008, 0x0FFFFFF0}, // FLASH_HLR : lock/unlock blocks }; static int Program5534(void) { int result; DWORD errorAddr; /* reset and init target */ result = BDI_TargetStartup(100, // 100ms reset time (2<<8) | 3, // MPC5534, 8 MHz JTAG clock sizeof initList5534 / sizeof initList5534[0], initList5534); /* setup flash programming */ result = BDI_FlashSetType(BDI_FLASH_H7F, 0x80000, 16, // MPC5534 has 16 byte page size 32, 0x40001000); if (result != BDI_OKAY) return result; /* erase flash */ printf("erasing ... "); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_MID, 0x00000003); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_HIGH, 0x0000000F); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("programming..."); result = BDI_FlashWriteBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("verifing... "); result = BDI_VerifyBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf("passed\n"); return result; } /* Program5534 */ /**************************************************************************** **************************************************************************** Program5517 : ****************************************************************************/ static BDI_InitTypeT initList5517[] = { {BDI_INIT_P55_WSPR, 8007, 100}, // Wake-up delay 100 ms {BDI_INIT_P55_WSPR, 8004, 0}, // Select memroy access via OnCE {BDI_INIT_P55_WTLB, 0xFFF0058A, 0xFFF0003F}, // Periph. : 0xfff00000 -> 0xfff00000, 1MB, --I-G- {BDI_INIT_P55_WTLB, 0x4000048A, 0x4000003F}, // Int.SRAM: 0x40000000 -> 0x40000000, 256KB, --I-G- {BDI_INIT_P55_WTLB, 0x0000078A, 0x0000003F}, // Flash : 0x00000000 -> 0x00000000, 16MB, --I-G- {BDI_INIT_P55_FILL, 0x40000000, 0x14000 }, // init ECC-SRAM {BDI_INIT_P55_WM16, 0xFFF40016, 0x0051 }, // MCM_SWTCR: disable watchdog // Speed-up system clock to fsys = 48MHz {BDI_INIT_P55_WM32, 0xFFFE89A0, 0x00000000}, // SIU_SYSCLK: select 16 MHz IRC as system clock {BDI_INIT_P55_WM32, 0xFFFF0008, 0x80030050}, // FMPLL_ESYNCR1: (EPREDIV+1)=4, (EMFD+16)=96 {BDI_INIT_P55_WM32, 0xFFFF000C, 0x00000005}, // FMPLL_ESYNCR2: (ERFD+1)=6 {BDI_INIT_P55_WM32, 0xFFFF0008, 0xF0030050}, // FMPLL_ESYNCR1: select PLL mode {BDI_INIT_P55_DELAY,0, 100 }, // let PLL lock {BDI_INIT_P55_WM32, 0xFFFE89A0, 0x80000000}, // SIU_SYSCLK: select PLL as system clock // Lock/Unlock Flash Blocks for Erase/Programming {BDI_INIT_P55_WM32, 0xFFFF8004, 0xA1A11111}, // FLASH_LMLR : unlock register {BDI_INIT_P55_WM32, 0xFFFF8004, 0x001CFFFF}, // FLASH_LMLR : lock/unlock blocks {BDI_INIT_P55_WM32, 0xFFFF800C, 0xC3C33333}, // FLASH_SLMLR: unlock register {BDI_INIT_P55_WM32, 0xFFFF800C, 0x001CFFFF}, // FLASH_SLMLR: lock/unlock blocks {BDI_INIT_P55_WM32, 0xFFFF8008, 0xB2B22222}, // FLASH_HLR : unlock register {BDI_INIT_P55_WM32, 0xFFFF8008, 0x0FFFFFF0}, // FLASH_HLR : lock/unlock blocks }; static int Program5517(void) { int result; DWORD errorAddr; /* reset and init target */ result = BDI_TargetStartup(100, // 100ms reset time (3<<8) | 3, // MPC5517, 8 MHz JTAG clock sizeof initList5517 / sizeof initList5517[0], initList5517); /* setup flash programming */ result = BDI_FlashSetType(BDI_FLASH_H7F, 0x80000, 16, // MPC5517 has 16 byte page size 32, 0x40001000); if (result != BDI_OKAY) return result; /* erase flash */ printf("erasing ... "); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_MID, 0x00000003); if (result == BDI_OKAY) result = BDI_FlashErase(BDI_ERASE_HIGH, 0x0000000F); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("programming..."); result = BDI_FlashWriteBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf((result == BDI_OKAY) ? "passed\n" : "failed\n"); if (result != BDI_OKAY) return result; printf("verifing... "); result = BDI_VerifyBinary("E:/temp/dump512k.bin", 0x00040000, &errorAddr); printf("passed\n"); return result; } /* Program5517 */