Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20644 Discussions

MAX 10 UFM/On Chip Flash Erase operation help

kelvinly_steris
Beginner
571 Views

EDIT: It looks like I was making some mistakes elsewhere, the below works correctly for anyone else looking to erase the UFM using low level HDL code.

 

Hello! I am working with the 10M16SCU169I7G and can successfully read from the UFM (after applying the patch from the knowledge base), but I am having trouble implementing the erase and write operations. Would you have any advice on where my process is going wrong, or any example code or projects I could look at?

I am trying to erase the UFM contents a sector at a time using a simple FSM module. It is currently doing this:

Waiting for the memory to be idle by polling the CSR register:

clock 0: csr_addr = 0, csr_read = 1,

clock 1: csr_addr = 0, csr_read = 0, check lowest two bits of csr_readdata here

When those two bits are 2'b00, then write to the write protection bits:

csr_addr = 1, csr_write = 1, csr_writedata = 32'h7c7fffff (I'm actually using {4'b1111, 5'b11000, {(23){1'b1}}}) here

Then write the sector number to start the erase:

csr_addr = 1, csr_write = 1, csr_writedata = {4'b1111, 5'b11000, cur_sector + 3'b001, {(20){1'b1}}}, cur_sector = 0

And then polling the CSR status register like above to wait until it's no longer busy, and then it increments cur_sector to repeat the process for cur_sector from 0 to 2 (corresponding to sectors 1, 2, and 3), and all transitions are happening the positive edge of the same clock that is being fed into the on chip flash. I have tried swapping the order of the CSR busy polling with the write protection but neither order seems to make a difference, the Flash retains its original contents

0 Kudos
5 Replies
JohnT_Intel
Employee
557 Views

Hi,


May I know what is the clock frequency used? May I know if you are using the same clock between the On Chip Flash and your state machine?


Is it possible to share your design?


0 Kudos
kelvinly_steris
Beginner
531 Views

Yeah it's resolved itself, I wasn't triggering the erase FSM correctly. Thanks for the help though!

0 Kudos
jozephka99
New Contributor II
546 Views

Idk if this help you but I send you my VHDL code with UART interface about manipulating UFM. But you must change the addresses because I wrote it for 10M08.  

0 Kudos
kelvinly_steris
Beginner
529 Views

Thanks for the example code, I figured it out

0 Kudos
JohnT_Intel
Employee
516 Views

I am glad that the issue is resolved


0 Kudos
Reply