Author Topic: Interrupt Handling  (Read 10614 times)

WeakDude

  • Active Member
  • *
  • Posts: 5
Interrupt Handling
« on: April 02, 2012, 12:41:55 AM »
Hello,

I'm using Eddy-S2M/Pin with Eddy-CPU v2.0 and I would like to build a frequency meter using one of four GPIO pins. The best way to do this is to handle an external interrupt when logical one appear on one of the pins but I can't figure out how to use interrupts. Could anyone help me?

Thanks in advance.

Best Regards,
Mark

Antti Lukats

  • Hero Member
  • *****
  • Posts: 542
Re: Interrupt Handling
« Reply #1 on: April 02, 2012, 08:38:41 AM »
The performance would be very low.

what is your maximum desired frequency to be measured?

but I think in ALL cases its better to add external small MCU or smallest FPGA to handle the frequency and convert it to say serial or i2c for the eddy to ready out

Antti

WeakDude

  • Active Member
  • *
  • Posts: 5
Re: Interrupt Handling
« Reply #2 on: April 02, 2012, 10:04:18 AM »
I would like to measure a 20-30kHz square wave.

With interrupt handling, I would have to just increment some value on every rising edge of the signal.


Antti Lukats

  • Hero Member
  • *****
  • Posts: 542
Re: Interrupt Handling
« Reply #3 on: April 03, 2012, 04:41:35 PM »
Hi

30 KHz could be possible, but I would say only if done as kernel module, not as user space application.
It would be better to use some timer to count pulses, but this as well may still need kernel module development.

Are you developing with linux?

Antti

WeakDude

  • Active Member
  • *
  • Posts: 5
Re: Interrupt Handling
« Reply #4 on: April 03, 2012, 08:42:27 PM »
Unfortunately, no...

I used interrupts in ARM but without Linux. I don't have any experience with Linux kernel programming so it might be to hard for me.

It seems that best way to measure this signal is using another uC (Atmega8?) and sending result to Eddy.

On my board there are 4 GPIO Pins and RS422/485 interface (Eddy-S2M/PIN JIG - Pin-to-DB9 gender) - is it possible to connect Eddy with atmega8 through USART? (by disconnecting Eddy-S2M/PIN JIG)

Antti Lukats

  • Hero Member
  • *****
  • Posts: 542
Re: Interrupt Handling
« Reply #5 on: April 04, 2012, 08:23:12 AM »
YES

I agree fully, please use some small micro of your choice, measure and send the result as maybe ascii string with terminating <CR> over uart. Trying todo it in kernel driver is way more hassle then doing it with small external mcu and using ready communication interfaces that are accessible from user space (serial ports)

Antti