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

How to port AVR DMX code to Intel Quark (on Edison) ?

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:

  1. _SFR_IO_ADDR()
  2. _SFR_IO8()
  3. cli() / noInterrupts()
  4. sei() / interrupts()
  5. digitalPinToBitMask()
  6. 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-Inte.../wiring_digital.h:106:56: error: 'PinDescription' has no member named 'ulPin' # define digitalPinToBitMask(P) ( g_APinDescription[P].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 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 ?

 

If the AVR Arduino code can be ported/updated and still work in the Arduino IDE for Edison that would be cool,

 

but if not I wouldn't mind porting my existing Arduino DMX code to c+libmraa as long as it works.

Thank you,

 

George

P.S. This is cross-post as suggested by matthias-hahn (Intel)

12 Replies
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi George.profenza,

Let me investigate on your question, I'll let you know when I've found some useful information. In the meantime, take a look at this link /message/265851# 265851 https://communities.intel.com/message/265851# 265851 . It discusses DMX, maybe you can find some useful information.

Regards

Sergio

Highlighted
New Contributor I
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi,

That's right along the lines of what I need, thank you!

Will see if I can get Oliver's approach running on the Edison.

Thanks,

 

George
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi,

Was the previous suggestion helpful? What were your results?

Regards

Sergio

Highlighted
New Contributor I
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi Alvarado,

Unfortunately I didn't get very far with the suggestion.

Some of the problems are that the pin muxing from Galileo Gen1 and Edison are quite different.

Oliver's solution is also relying on Arduino code, system calls (from within the Arduino code)

and modifying the arduino IDE core to support a higher baud rate.

I was hoping for directions to a cleaner solution using libmraa/UPM in the hope of this being

simple to use for other people as well. I'm guessing I'm not the only one interested

in using DMX on the Edison.

At the moment I'm not very experienced. I started playing with electronics using Arduino

and I'm still getting the grips with it, so any hints/tips on how to find the equivalent constants/ports/pins

from atmega328 to Intel Quark would be very useful.

Thanks again for your help so far and for checking back,

George

0 Kudos
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi george.profenza,

Let me see what additional information I can find about DMX, I'll let you know as soon as I have a reply.

Regards

Sergio

0 Kudos
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi george.profenza,

Libraries that include AVR are not easy to port since AVR libraries are specific to the Atmel processor found on the Arduino boards. Edison has an Atom x86, my suggestion would be to find a python/C code that will meets your project requirements.

Take a look at this link: https://github.com/c0z3n/pySimpleDMX https://github.com/c0z3n/pySimpleDMX . It is a python program specific for a usb dmx.

Unfortunately I don't have a DMX controller to test this and it is not on the list of supported shields but you can try these suggestions and post your results in the community.

Regards

Sergio

0 Kudos
Highlighted
New Contributor I
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi Sergio,

If the AVR code can be ported to Edison's Quark MCU, that's great,

if not, writing python/C code for the Atom is also an option.

The goal is to do send DMX data from an Edison board alone,

so essentially giving the Edison the functionality similar to the Enttec USB Pro

DMX controller you've linked through the pySimpleDMX library.

The main reason would be keeping the form factor small, wearable and running

on an Intel only platform. One workaround could be using Arduino Block for Edison

from Sparkfun, but this is what I'm trying to avoid at the moment.

What do you recommend in this case ?

Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi george.profenza,

If you are worried about the size why don't you try using a breakout board? It is a smaller option than the Arduino expansion board and it may be a better suit for your project. Look at the hardware guide here http://www.intel.com/support/edison/sb/CS-035252.htm http://www.intel.com/support/edison/sb/CS-035252.htm .

Regards

Sergio

0 Kudos
Highlighted
New Contributor I
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

@Intel_Alvarado In theory I could use a Sparkfun Arduino Block and simply compile existing code on the Atmel chip, but I am aiming to run the code on Intel's chip instead.

Can Intel Quark's timing support the strict timing required by the DMX protocol ?

 

Regarding the breakout board list supplied I haven't spotted a DMX or RS485 board listed (ideally a small form factor to be used with the small Edison breakout)

 

0 Kudos
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi,

According to http://playground.arduino.cc/DMX/Protokoll Arduino Playground - Protokoll , a DMX bit is 4us long. It is not possible to toggle the pins every 4 μs with the MCU. We toggled all digital pins (0-13) individually and the fastest we got was 5.7 μs with DIG3 and 5.83 μs with DIG5. Keep in mind that these results come from just toggling on/off each pin individually without any other instructions.

Sergio

0 Kudos
Highlighted
New Contributor I
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Intel_Alvarado Thank you very much Sergio.

Some insights on the internals is what I needed.

As far as I understand, toggling a single pin would give you the same result (~5.8μs), correct ?

Sounds like the Sparkfun Arduino Edison block is the most viable option in this case

0 Kudos
Highlighted
Employee
5 Views

Re: How to port AVR DMX code to Intel Quark (on Edison) ?

Hi,

Yes, those results are from toggling each pin individually. 5.7 μs with DIG3 and 5.83 μs with DIG5 were the fastest results we got.

Sergio

0 Kudos