Question
Save ADC Data in Flash
Posted on July 26, 2013 at 09:54
Hi,
I'm trying to sample a signal with the ADC and store data in the Micro Internal Flash. At the moment I sample the data with the ADC in continous mode and save the Data from ADC1_DR_Address with the DMA in RAM Area, but I need store more data. Is it possible that the DMA write it directly in Flash Area? I tried to save the data using ''FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);'' function but the time it takes to write the buffer is more time than it takes to fill completely. For example if my Ram Area is 70Kb i can save 70*1024/2 samples, and i fill that in 1 second (aprox I sample at 35Khz), but if I want to write 35K samples with FLASH_ProgramWord it takes arrond 1.25 seconds if I do so:/* Reset flags */
FLASH_ClearFlag(FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR | FLASH_FLAG_EOP); /* Fill the flash buffer */ addr = (uint32_t)INIT
_FLASH_ADDR_DATA_REGION; FLASH_Unlock(); nw = TS_FLASH_size >> 2; for (i=0 ; i<nw ; i++) { status = FLASH_ProgramWord(addr, 2datasamples[i]); if (status != FLASH_COMPLETE) { FLASH_Lock(); /* Fail saving data */for(;;); } addr += 4; } FLASH_Lock(); so I can't record the Data when the interruption DMA_IT_HT of the DMA, occurrs. Is possible write in flash faster?? Best Regards,