Hi,
Sorry I must have replied too quickly and forgot the details!
For the FLASH_MEM_OP, bit 3 is the write enable bit. First you need to write bit 3 and the sector number, THEN write bits 0 and 1 with the erase command and the sector number. I tried to write the write enable bit and the erase bit at the same time, but that did not work. However, this is all for the Serial Flash Controller II. I am not using asmi2, but according to the documentation, the serial flash controller is just a wrapper over the asmi ip.
For the generated driver code I was talking about, I generated it using the bsp editor and it should be under projectName_bsp -> drivers. The headers and source reg and driver files should be there. However, like I said before, I never tried generating it for asmi II, but I did try using asmi2, but gave up and went back to serial flash controller ii. I am using the HPS to try to program, but wanted figure out if my problem was with my code or the IP so I tried using NIOS.