Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
1,014 Views

Hardeware or Software Interrupt for Serial Connection is it possible?

Hello,

I have a Question about Interrupt in Galileo Gen2.

I want to use Interrupt Handler, so a function will be automatically called when Galileo Serial ttyS0 receive a new charachter.

With mraa_uart_data_available I can do that but the programme must be in loop.

With fcntl and SIGIO i tried to but no solution.

I can also creat new Thread, but that the same like the first solution (in the loop).

Is there any pre-defined Interrupt for serial connection in Galileo Gen2 to be able to receive charachter without loop?

Best regards

0 Kudos
9 Replies
Highlighted
Honored Contributor I
8 Views

Hi Yacine85,

Is there any pre-defined Interrupt for serial connection in Galileo Gen2 to be able to receive charachter without loop?

I do not think so, even Arduino's SerialEvent works as expected and has to be explicitly called... it would be good to have a pre-defined Interrupt for serial connection, though.

Edit: sorry, it had to be: "I do not think so, even Arduino's SerialEvent does not work as expected and has to be explicitly called..."

Fernando.

Highlighted
New Contributor I
8 Views

Hi Fernando,

Thank you for your reply.

I forgot to say i'm not Arduino-fun I use eclipse And i mixe Assembler and C/C++ in my project.

Regards

Highlighted
Honored Contributor I
8 Views

I forgot to say i'm not Arduino-fun I use eclipse And i mixe Assembler and C/C++ in my project.

Yes, I guessed it from this and other thread/s.

I was trying to say that the behavior/feature you are asking for is not working under the Arduino environment, where there is a specific function for doing it, so I do not think it is implemented in other Galileo development environments. Unfortunately, I made a mistake and my previous post could be viewed as "change to Arduino". It was my mistake... the Intel Galileo Arduino IDE does not provide any thing for what you (and many others) need. I edited my previous post fixing my mistake.

Fernando.

0 Kudos
Highlighted
New Contributor I
8 Views

Yes, i find that too.

You know what i'm thinking, rx/tx UART in Embedded system today is not like an old classical UART RS232 where many control pins (like RTS, DTR) must be included.

Hardware interrupt is nothing more as a physical signal; in Intel Galileo i can make interrupt in each pin (ISR Handler already included in Eclipse/Intel Galileo)

Software interrupt is nothing more as a task in thread; that cheek the status of a variable/process and i can creat a new one.

I think, if there a special hardware interrupt, Intel will document it.

Well, we'll wait for a reply from others...

0 Kudos
Highlighted
Community Manager
8 Views

Hello Yacine85,

 

 

As Fernando mentioned, there is none explicitly, the mraa interrupt capabilities are mostly selecting if a rising, falling or both edges trigger it. What you might be able to do is set the interrupt on the Rx pin of Edison and in the interrupt event, set the Edison to read the rest of the message. I suggest you to read http://iotdk.intel.com/docs/master/mraa/gpio_8h.html# a61e3a45eb7daad362af4a116d01111fa to understand how the mraa interrupt works.

 

 

Peter.
0 Kudos
Highlighted
New Contributor I
8 Views

Hey Peter,

Thank you for your reply.

Yes, that's a good solution but i must check if that works with rx, because one message have a 8 bits +1, so maybe will interrupt 8 times until be able to read one character

I'm must try.

Regards

0 Kudos
Highlighted
New Contributor II
8 Views

I don't know what you want to do with the Galileo, but either you try to do something that is not feasible with the Galileo, or you have misunderstood how interrupts are working on the serial port.

The UART will only trigger one interrupt when a full byte is received. The UART will not trigger an interrupt for every bit it receives in a byte.

The second possibility is that you try to make a "software UART", where you get an interrupt for every bit cell. This is something that you can do with some microcontrollers (if the baudrate is not too high), but this will never work on a Galileo. You would need a timer to do that, and you have no access to such timer from Linux on the Galileo

Benoit

0 Kudos
Highlighted
New Contributor I
8 Views

Actually if i use mraa_result_t mraa_gpio_isr with pin 0 (RX) i must configure edge :

Gpio Edge types for interrupts:

No interrupt on Gpio

Interrupt on rising & falling

Interrupt on rising only

Interrupt on falling only

http://iotdk.intel.com/docs/master/mraa/gpio_8h.html# aa63b1011283ae2ad97e7083029547494 mraa: /iotdk/jenkins/workspace/mraa-doc/api/mraa/gpio.h File Reference

0 Kudos
Highlighted
New Contributor I
8 Views

You have right, when configure UART pin 0 = rx, interrupt will be occured only when a full byte is received, for another pin we need to configure the signal edge.

I want to add something:

the buffer of rx-uart has length of 8 characters

Regards

0 Kudos