From: jfh on
Hi,

The setup is the following :
- a stratix II GX hosts a Nios IIe
- one timer running continuously at a period of 1s, priority level 6,
the handler for this interrupt has some functions calls to usleep and
performs polling, this handler is made interruptible via the use of
the alt_irq_interruptible and alt_irq_noninterruptible pair of
functions
- one hw interrupt generates an interrupt every 500 us with a prioity
level 2 a uart running at 115 kbauds using the small driver
implementation (no interrupt)
- the main function of the C program is waiting forever for characters
to come in via the uart and when a command is received it processes it
and gets back to expecting a new command forever

With this setup it seems that the uart does not work well. When I
pause the program after noticing it does not respond the program is
almost always located in the usleep function called from the low
priority interrupt handler. Is there anything in the setup described
that is bad design ? What am i missing ? All ideas are welcome !

Best regards,

JF
From: Adam Górski on
jfh pisze:
> Hi,
>
> The setup is the following :
> - a stratix II GX hosts a Nios IIe
> - one timer running continuously at a period of 1s, priority level 6,
> the handler for this interrupt has some functions calls to usleep and
> performs polling, this handler is made interruptible via the use of
> the alt_irq_interruptible and alt_irq_noninterruptible pair of
> functions
> - one hw interrupt generates an interrupt every 500 us with a prioity
> level 2 a uart running at 115 kbauds using the small driver
> implementation (no interrupt)
> - the main function of the C program is waiting forever for characters
> to come in via the uart and when a command is received it processes it
> and gets back to expecting a new command forever
>
> With this setup it seems that the uart does not work well. When I
> pause the program after noticing it does not respond the program is
> almost always located in the usleep function called from the low
> priority interrupt handler. Is there anything in the setup described
> that is bad design ? What am i missing ? All ideas are welcome !
>
> Best regards,
>
> JF

Hi,

AFAIK interrupts in NIOS II e have software processing. So all
interrupts are connected to same handler with soft processing.

Change nios version to faster one or you can try add interrupt custom
instruction to reduce interrupt latency.

BR

Adam
From: jacko on
On 16 Mar, 06:16, jfh <jeanfrancois.has...(a)gmail.com> wrote:
> Hi,
>
> The setup is the following :
> - a stratix II GX hosts a Nios IIe
> - one timer running continuously at a period of 1s, priority level 6,
> the handler for this interrupt has some functions calls to usleep and
> performs polling, this handler is made interruptible via the use of
> the alt_irq_interruptible and alt_irq_noninterruptible pair of
> functions
> - one hw interrupt generates an interrupt every 500 us with a prioity
> level 2 a uart running at 115 kbauds using the small driver
> implementation (no interrupt)
> - the main function of the C program is waiting forever for characters
> to come in via the uart and when a command is received it processes it
> and gets back to expecting a new command forever
>
> With this setup it seems that the uart does not work well. When I
> pause the program after noticing it does not respond the program is
> almost always located in the usleep function called from the low
> priority interrupt handler. Is there anything in the setup described
> that is bad design ? What am i missing ? All ideas are welcome !
>
> Best regards,
>
> JF

maybe just have the one interrupt at 500us and every 2 interrupts do
the 1s stuff. Maybe set a flag to return to sleep in the interrupt and
do the actual sleep in the main loop.

Cheers Jacko