- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
with C using libmraa:
https://github.com/intel-iot-devkit/mraa/blob/master/examples/isr_pin6.c
with python using mraa:
https://github.com/intel-iot-devkit/mraa/blob/master/examples/python/hello_isr.py
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the example is nice, but it does not tell you how to safely manage resources, that you feed into the interrupt function via the void* args parameter. If you only use static resources, everything will be fine. But if you use dynamically allocated resources in your interrupt function, there is no safe way to deallocate the resource, since you don't know if the interrupt function is still using the resource.
By calling mraa_gpio_close will not cancel the interrupt handling thread. By doing this, the gpio file will be closed and the interrupt handler thread will terminate the next time it tries to poll the interrupts. When this will happen, depends on your interrupt function. If you deallocate your resources immediately after calling mraa_gpio_close, the interrupt function may still use the deallocated memory.
But there is another option. You can call mraa_gpio_isr_exit, which tries to cancel the thread immediately. The problem is that this function also does not guarantee that the thread is canceled after the call. If your interrupt function is being executed, the thread will continue to run until your function exits, because thread cancellation is disabled as long as the interrupt function is being executed. So you can not safely deallocate your resources after calling mraa_gpio_isr_exit.
Currently you will have to wait some time after mraa_gpio_close or mraa_gpio_isr_exit and hope that your interrupt function will be finished after the given time span.
Best regards,
Bernd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm new to Intel Edison development and just a bit of prior Arduino knowledge behind so please bare with me :)
I am trying to port some Arduino code and an implementation of the DMX protocol, but I think I need to
find equivalent Quark calls for the existing AVR code.
Here are the functions/constants I will need to replicate on Intel Edison:
- _SFR_IO_ADDR()
- _SFR_IO8()
- cli() / noInterrupts()
- sei() / interrupts()
- digitalPinToBitMask()
- NOT_A_PORT / PORTB / PORTC / PORTD
From what I understand in this post, interrupts()/noInterrupts() can be achieved with libmraa.
Would I use that in plain c on the linux side or from the Arduino IDE ?
I found digitalPinToBitMask() in hardware/arduino/edison/cores/arduino/wiring_digital.h but I get an error when I try to use it:
C:\Users\HM\Downloads\Windows\arduino-windows-patched-1.0.4\arduino-windows-1.0.4\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino/wiring_digital.h:106:56: error: 'PinDescription' has no member named 'ulPin' #define digitalPinToBitMask(P) ( g_APinDescription.ulPin )
I've also found this GPIO reference I'm going through at the moment:
http://www.emutexlabs.com/project/215-intel-edison-gpio-pin-multiplexing-guide
Is it feasible to port the DMX code to the IntelEdison ? Where could I find the AVR equivalent calls/constants for Edison ?
Thank you,
George
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@George
would you mind copy&pasting this feature request to https://communities.intel.com/community/makers/? The forum you posted here is mostly around Intel IoT developer kit but not about Arduino IDE which isn't part of the devkit.
On questions on how to bring it to C/C++/Python or Node.JS using the devkit feel free to continue on this forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mattias,
Thank you for the advice. I will ask on the Makers community as well.
If I can get the code running in Arduino that would be great,
but I'm not excluding porting the code to c or python using libmraa
in which case the questions on finding equivalents for the AVR
constants and functions within libmraa remain.
Would you consider it's possible to do this sort of port manipulation with libmraa ?
If so, how can I continue ?
Thanks,
George

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page