Friday, August 26, 2011

Hanging by a Thread

The stupid firmware is still hanging in the middle of serial output; don't know why...  It's difficult to debug this sort of thing!  I thought maybe the SOPC config was still not in sync, but I checked all the base addresses, and they are right now.  Then I thought, OK, maybe the stack is overflowing again, but I increased the reserved space from 15K to 20K, and that didn't help.

I cleaned up the interrupt code a little, and decreased the code size a little.  Something I did worked (not sure what) because stdio is working again.  Maybe the code size was just getting too close to the limit and this was causing problems for some reason.  However, I'm still not seeing any pulse-capture interrupts.

Maybe it is a performance issue - i.e. the pulse_cap module is not coming close to meeting its timing constraints, and as a result it is never getting to the point of producing output handshakes.  Indeed, fmax is reading as only 270 MHz or so, for some reason.  I'll cut down the PLL speed to 250 MHz temporarily (from 500 MHz) and see if that helps.

Not only did that not help, but now I'm having the stdio problems again.  Sigh...

Shrunk my code again; this time I got one interrupt and part of another before it crashed!  Progress...

More shrinking, and turning the reporting level down to warning level, fixed the problem.  Lesson learned:  The first time anything weird happens, make sure the total code size is somewhat less than the maximum (which seems to be about 73K in the present environment, which makes sense due to our 64K ROM for .text and .rodata, and the 9K RAM for .rwdata).  Still unsure, though, why the linker isn't warning me before something goes wrong...  Anyway, we're good for now.

Before leaving for the day, I Dremeled down the pins on the 2nd SMA connector and plugged it into the thru-holes in its proper location on the board (PMT2, J32).  (Note:  Neither connector is actually soldered in yet.)  As soon as I find the BNC-to-SMA cables, or a second BNC-to-SMA converter jack, I can hook up the 2nd test PMT, and test the system with two input channels.  (It might even work now!)

No comments:

Post a Comment