This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash Read Issue in NRF52

Hi All,

In Flash read am facing one issue .

Am writing some data to Flash and trying to read back, But when I read back I get some corrupted data or am not able to read in Flash .Am using this code to test flash read timings in Heart rate Sensor example in 11.0.0.2 alpha SDK with NRF52 DK . Here is my code snippet :

**// flash write**

    pg_size = NRF_FICR->CODEPAGESIZE;
    pg_num  = NRF_FICR->CODESIZE - 1;  // Use last page in flash
    addr = (uint32_t *)(pg_size * pg_num);
    printf("Page Size %d\r\n",pg_size);  // it is 4096 
    flash_page_erase(addr);
    printf("before flash write\r\n");
    for(i=0;i<4096;){
			i=i+4;
                        flash_word_write(addr,(uint32_t)'1');
                        ++addr;
    }
    printf("After flash write\r\n");

**// flash read**


   addr = (uint32_t *)(pg_size * pg_num); 

   for(i=0;i<4096;){
 
    addr++;

     printf("flash data:%d %c \r\n",i,*addr);

     i=i+4;

  }

First 32 (i=32) are coming properly but after that some random prints are coming , Am I doing anything wrong ??

I tried memcpy also that to have the same issue ,

Parents
  • OK, the problem was not the flash but the UART buffer. The size of the buffers is dependent on how fast you are writing and reading to/fromt he driver. It is OK to select 256 bytes of TX and RX if you have space for it. You can print as much as you want , the size of this buffer is not restricting you on how much you can log but it is restricting you how fast you can read and write to the UART driver.

Reply
  • OK, the problem was not the flash but the UART buffer. The size of the buffers is dependent on how fast you are writing and reading to/fromt he driver. It is OK to select 256 bytes of TX and RX if you have space for it. You can print as much as you want , the size of this buffer is not restricting you on how much you can log but it is restricting you how fast you can read and write to the UART driver.

Children
Related