Hi,
Can anyone explain to me what the following functions do?
void Write_flash_page(unsigned int PAGE_ADDR, unsigned char* flash_page_data_buff, unsigned short page_data_count){ *pREG_SPI2_SLVSEL &= ~ENUM_SPI_SLVSEL_SSEL1_HI ; // selct_flash; flash_byte_access(FLASH_WR_EN); // send write enable command *pREG_SPI2_SLVSEL |= ENUM_SPI_SLVSEL_SSEL1_HI ; // deselct_flash; wait_for_flash_status(WEL, 1);
*pREG_SPI2_SLVSEL &= ~ENUM_SPI_SLVSEL_SSEL1_HI ; // selct_flash; flash_byte_access(FLASH_PG_PRM); // send page program command flash_byte_access(PAGE_ADDR >> 16); flash_byte_access(PAGE_ADDR >> 8); flash_byte_access(PAGE_ADDR);
int i; for(i=0; i<page_data_count; i++) flash_byte_access(*flash_page_data_buff++);
*pREG_SPI2_SLVSEL |= ENUM_SPI_SLVSEL_SSEL1_HI ; // deselct_flash;
wait_for_flash_status(WIP, 0);}
unsigned char flash_byte_access(unsigned int Databyte){ // read RFIFO till it is empty while(!(*pREG_SPI2_STAT & BITM_SPI_STAT_RFE)) *pREG_SPI2_RFIFO;
*pREG_SPI2_TWC = 1; // single byte instruction, no addr/data *pREG_SPI2_TFIFO = Databyte; // command ID while(!(*pREG_SPI2_STAT & BITM_SPI_STAT_TF)); // wait till completion *pREG_SPI2_STAT = BITM_SPI_STAT_TF; // clear latch return *pREG_SPI2_RFIFO;}
let's assume, I have a buffer which I want to write it into the start addresse 0x0000 for flash (w25Q32BV) which it is in series with BF706. Then next buffer will be written into the next addresse 0xFF (size of each page is 256), and so on for the block number 0.
Best Regards
SVA
Hi SVA,This issue is already handled through private support. To avoid duplication of efforts, you can continue the discussions through private support and we will post the final resolution here if appropriate…
Hi SVA,This issue is already handled through private support. To avoid duplication of efforts, you can continue the discussions through private support and we will post the final resolution here if appropriate.Regards,Anand Selvaraj.