Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

How to freeze NIOS2 during sensitive measurement?

Hi community,

we currently design a device where we use logic in a Cyclone for very accurate measuring. Beside the logic for measuring, there is a NIOS II in the same FPGA to processing the results.

We found that measurement results are affected by the amount of activity in the NIOS and evaluate various methods to slow down or freeze the NIOS while measuring.

Measurement takes place at 20 kHz rate and takes the same amount of time as a handful of instructions would.

1. Attempts to simply gate the CPU clock had bad side effects such as missed interrupts. We didn't gate the clock of timers and other peripherals, because they have to keep running with exact timing.

2. Second idea was to generate an interrupt while measuring, so a handler could just make an NOP loop until the measurement is done. But calling the standard interrupt handler at 20 kHz would eat far too much CPU ressources. So a custom preamble code in the exception handler for this particular source would have to be written (we didn't try that yet).

3. Third idea could help to improve results if our problems were mostly caused by access to _external_ SRAM (e.g. for data): To gate the ACK signal from the tristate_bridge so that data access while measuring. E.g. by adding another "bridge" between CPU and avalon_tristate_bridge?

4. We could inject NOP opcode (or rather a branch -1) on data bus during measurement. But that would certainly cause huge problems with instruction caching.

5. Maybe a custom instruction could be used. But then again that would have to be triggered by an interrupt or the like.

6. Is there any other possibility to halt the processor from a source external to the core?

Any further ideas, hints, tipps?

Thanks in advance

Kolja

11 Replies