So the board has an issue somewhere.... or issues.
When programming it (the SPIFlash IC) via the SPI pins, it will only entertain programming from an FPGA cold boot into RESET. If the FPGA configures at all it will no longer let go of it's own SPI drivers. The datasheet is confusing and split into multiple parts, but I can't find this particular behaviour spelt out. One long shot is that as I enable the RGB LED drivers, which co-exist on the IP block with the SPI IP that enabling it, enables the SPI block too. Because that SPI block (in Slave) can be used during programming it is not reset with cRESET. Thus, that bit stream when flashed can only be programmed "dark" and not "POR". Long shot though.
Thats not all though. It has some signal integrity issues. The worst offender is the SPI_SS line. When SPI is idle and SS falls it's clean. ~10mV noise. Nice sharp 10ns edge on the fall. The moment SPI starts clocking though and the SS line comes alive with high frequency noise and ringing. Like up to 1Vpp around 0V. That is a 10cm steel pin jump lead to a breadbard straight to an STM32 pin. So there will be some breadboard foolery in there, I expect the ringing. But the "block" of noise on the SS line is cross talk and I think I know why.
The SPI clock signal itself is fine. Clear, sharp, a bit of noise on the over/undershoot but tame and fine.
The SS line as it is in my schematic and layout is a dead end track with nothing at all on it. There is no pull up, both "pins" it points at will be HiZ. No resistance on it at all. So the MCU holding it at 0V there is no current going anywhere. Its subjected to the whims of the electromagnetic fields and as it runs straight under the SPI flash chip, then for another centimeter to the HiZ FPGA pin, it's an anntenna for all that SPI digital clocking noise. Thats just a theory.
For now it doesn't matter. I can program it, it just has "moods". "Moods" where it just won't verify. Moods where it will.
I spent a few hours debugging at it last night when it was in a "No program me mood" and I went through the scope in decode both reads, writes, busy polls and nothing was out of place....except that persistent noise.
I got the logic analyser out and recorded a full flash write of a bin file 10 25Mhz. Everything was again "fine".... except when I compress the capture down to just the CSV "Events" file and opened it.... I spotted every few thousand events or so there was "??" inserted before the value. I hunted down 6 of these at random and ALL of them said the same thing. "The SS line glitched high here!"
A "random", "noise induced" transition on the SS line is more than enough to cause "Im not in the mood to program today".
The fact it has already started to verify again by the time I got there suggests there will be a tolerance of just how high and how long that glitch is before it actually aborts the operation in progress in the flash IC.
What to do about it though. As I said it isn't an issue, the circuit was made as a "tutorial ice breaker" kind of project. The board its going into for real will be flashed once, hopefully and never again. It also has a 4k7 pull up on SS/CS line. Shorter traces from pull ups to SPI chip and to FPGA as well.
Oh. Important detail. The SPI clock I am using is a "modest" 6Mhz. I'm not trying to push 30Mhz over jumpers! Maybe I should halve that. Its not like it takes long to write a bit stream for it.