# HG changeset patch # User ideenmodellierer # Date 1581358527 -3600 # Node ID 2174fb133dbe1e74f112b93167dc6e97eff787fb # Parent c2264ce139cb603de9887b13caa9377a5d82b7ed Optimize ef_write_block function: The function did single byte writing until a start of a page was detected. Only in that case a multi byte write was used. According to the manual page write is not limited to 256 byte. Multiple bytes may be written until the end of the page is reached => Changed implementation to always use multi byte writes which increases the performance of the write block function diff -r c2264ce139cb -r 2174fb133dbe Discovery/Src/externLogbookFlash.c --- a/Discovery/Src/externLogbookFlash.c Mon Feb 10 08:23:15 2020 +0000 +++ b/Discovery/Src/externLogbookFlash.c Mon Feb 10 19:15:27 2020 +0100 @@ -1633,7 +1633,8 @@ static void ef_write_block(uint8_t * sendByte, uint32_t length, uint8_t type, uint8_t do_not_erase) { uint32_t remaining_page_size, remaining_length, remaining_space_to_ring_end; - + uint32_t i=0; + if(!length) return; @@ -1688,7 +1689,7 @@ if(do_not_erase == 0) ext_flash_erase_if_on_page_start(); - for(uint32_t i=0;i= 256) && (remaining_space_to_ring_end >= 256)) + if(remaining_length >= 256) + { + remaining_length = 255; /* up to 256 bytes may be written in one burst. Last byte is written with release */ + } + else { - for(int j=0; j<255; j++) + remaining_length--; /* last byte needed for release */ + } + if(remaining_length >= (remaining_page_size) ) /* use 256 byte page and calculate number of bytes left */ + { + remaining_length = remaining_page_size - 1; + } + if( (remaining_space_to_ring_end >= 256)) + { + for(int j=0; j ringStop) actualAddress = ringStart; + if(do_not_erase == 0) ext_flash_erase_if_on_page_start(); }