Question
Ways to speed up writing to program flash
Posted on November 20, 2012 at 23:33
MCU is an STM32L MD part.
My application calls for optical-based software updates (don't ask if I can change it), and I'm at the process of writing that part of the software. I've been benchmarking how long it takes and for downloading and programming 60KB, it's taking about a minute and 10 seconds. This seems really long for some reason. I'm not using the peripheral library function calls for this (I was hoping putting the function in memory would help), and I tried the ramfunc version but the processor goes into lala-land after a few data packets are sent to it. My write operation is this: for(i = 0; i < 32; i++) { *(__IO uint32_t *)Address = Data[i]; Address += 4; status = FLASH->SR; /* Spin until operation is done. */ while((status & 0x00001F0F) != 0x0000000E) { status = FLASH->SR; } /* Break on errors */ if((status & 0x00001F00) != 0) { break; } } EDIT: I'm going to see if it's my PC app that I'm using the squirt the data over as well. I should mention that the PC app will not send data until the target has written the previous data and says it's okay to send the next one.