From 07ea9a75a05f541e30daf4d712a46945410f13ec Mon Sep 17 00:00:00 2001 From: cnlohr <lohr85@gmail.com> Date: Tue, 20 Jun 2023 06:09:21 -0400 Subject: [PATCH] Almost working. --- minichlink/pgm-b003fun.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/minichlink/pgm-b003fun.c b/minichlink/pgm-b003fun.c index 7b96054..596e5cc 100644 --- a/minichlink/pgm-b003fun.c +++ b/minichlink/pgm-b003fun.c @@ -62,11 +62,10 @@ static const unsigned char word_wise_write_blob[] = { // size and address must b }; static const unsigned char write64_flash[] = { // size and address must be aligned by 4. - 0x13, 0x07, 0x45, 0x03, 0x0c, 0x43, 0x13, 0x86, 0x05, 0x04, 0x5c, 0x43, - 0xb7, 0x02, 0x05, 0x00, 0x14, 0x47, 0x94, 0xc1, 0x23, 0xa0, 0x57, 0x00, - 0x91, 0x05, 0x11, 0x07, 0xe3, 0xca, 0xc5, 0xfe, 0xc1, 0x65, 0x93, 0x85, - 0x05, 0x04, 0xcc, 0xc3, 0x8c, 0xc3, 0xfd, 0x56, 0x14, 0xc1, 0x82, 0x80 - + 0x13, 0x07, 0x45, 0x03, 0x0c, 0x43, 0x13, 0x86, 0x05, 0x04, 0x5c, 0x43, + 0xb7, 0x02, 0x05, 0x00, 0x14, 0x47, 0x94, 0xc1, 0x23, 0xa0, 0x57, 0x00, + 0x91, 0x05, 0x11, 0x07, 0xe3, 0xca, 0xc5, 0xfe, 0xfd, 0x56, 0x14, 0xc1, + 0x82, 0x80, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; static const unsigned char half_wise_write_blob[] = { // size and address must be aligned by 2 @@ -160,7 +159,7 @@ static int CommitOp( struct B003FunProgrammerStruct * eps ) if( eps->prepping_for_erase ) { - usleep(8000); + usleep(10000); } int timeout = 0; @@ -460,6 +459,8 @@ static int B003FunBlockWrite64( void * dev, uint32_t address_to_write, uint8_t * if( MCF.PrepForLongOp ) MCF.PrepForLongOp( dev ); // Give the programmer a headsup this next operation could take a while. if( CommitOp( eps ) ) return -5; + MCF.WriteWord( dev, 0x40022010, CR_PAGE_PG|CR_STRT_Set); // (intptr_t)&FLASH->CTLR = 0x40022010 (actually commit) + r = B003FunReadWord( dev, 0x40022010, &word1 ); r |= B003FunReadWord( dev, 0x4002200c, &word2 ); printf( "WORD: %d %08x %08x\n", r, word1, word2 ); -- GitLab