NIOS II - Hanging on ECPQ / SPI initialization
So in our system we've recently added an EPCS/EPCQ flash controller IP. We've regenerated the BSP, it has all the fancy new files, and we're building in NIOS land.
However, when the NIOS application comes up, it runs the HAL initialization routines (alt_main), one of which is
ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT
In the above routine, we attempt to read the electronic signature. In doing this we send out an alt_avalon_spi_command(). In this function, we hang infinitely on the following code
/* Wait until the interface has finished transmitting */ do { status = IORD_ALTERA_AVALON_SPI_STATUS(base); } while ((status & ALTERA_AVALON_SPI_STATUS_TMT_MSK) == 0);
I can see the registers mentioned above not changing. Specifically, I am getting a TRDY (transmitter ready) and RRDY (Receiver ready) bits set. Both of those bits need to be set to 0 in order to exit this infinite loop.
So my question becomes, is there some necessary setup item to be able to talk with EPCS flash that I'm missing? All of the routines that get called up until this point are in the BSP, and from my understanding we should never have to edit the BSP files. This leads me to believe there is some setting in Quartus / NIOS II EDS that is getting missed.
Thanks so much in advance for any help you can provide!
Thanks for your time, but I was actually able to find the solution to this recently.
As it turns out, the issue was entirely configuration related. We added the EPCQ IP to the build, but forgot to actually flash the chip with the new fabric image. So we were trying to access EPCQ registers but the fabric image didn't know how to handle it.
So if you see this issue, make sure you have the latest and greatest fabric flashed onto your device! This was entirely the source if my issue.