frame

UDOO IDE Installation

Is it possible to install the Linux distribution to my UDOO Quad. As it has a Arduino due integrated into the system I have assumed that you would be able to do everything from within the Uudobuntu environment.

Any help would be appreciated.
Tagged:

Comments

  • Hello kenr,

    The Linux distribution of Viper is for x86_64 machines and cannot run on the ARM architecture of the UDOO. The alpha version of Viper was able to run on a UDOO but since then many things have changed (we included a C compiler for Viper hybrid code and git for project management) and now Viper is a bit too heavy to run on a UDOO. 

    However we are tightly collaborating with the UDOO guys to have Viper ready for their awesome NEO and a Viper ARM version will then be released.

    In principle, it is possible to viperize the arduino on the UDOO from a pc as i it were a normal arduino due. However the process is totally not user-friendly (see here) so we decided not to include it in Viper until we come up with something less messy.

    If you are really into it, and have some knowledge of python I can tell you how to modify Viper to flash a UDOO from a pc.


    Giacomo Baldi
    Zerynth Head of Software Development
  • kenrkenr Member
    Giacomo
    I agree it that the Udoo proposed method is poor. It would also appear that it does not support Arduino IDE 1.6x. No bossac support.
    Could you please give me you thoughts on modifying the Viper IDE in Python. 
    I'm sue I'm not the only one in this position.
    Thanks
  • Hello kenr,

    I can give you a few pointers to make Viper work with UDOO:
    1. get the patched bossac for your platform and put it under Viper/tools/your-platform/bossac/, renaming it so that it doesn't overwrite the original bossac in that directory. Viper for linux should have it there already.
    2. modify Viper/tools/tools.py : tools["bossac_udoo"] must be set to the name of the patched bossac. There is a different entry for each supported platform
    3. under Viper/ide/boards make a copy of arduino_due.py to something like myudoo.py
    4. modify myudoo.py by setting the id vendor and id model all uppercase in ids_vendor and ids_model
    5. modify myudoo.py by changing the method devmatcher. You must do something like return "udoo_description_string" in mth. You can find you udoo description string with "udevadm info -e" in linux and with ioreg for mac. Windows is a little bit messy. Or, you can simply return True if dev["vendor"] and dev["model"] match your ids_vendor and ids_model. You can check Viper/ide/boards/udoodual.py for some info (it is a test file I left there when playing with Viper 0.1.0 and Udoo)
    6. modify myudoo.py by setting manual_reset to 1. Arduino Due resets itself when opening the serial port to upload bytecode. Udoo Arduino must be reset manually.
    7. Start Viper, plug a Udoo and you should see it in the Board Toolbars.
    If everything goes well (namely, I haven't forgotten something  :D ), you should be able to viperize the Udoo and then upload bytecode to it.

    Don't esitate to report problems here, and keep up updated!

    Giacomo Baldi
    Zerynth Head of Software Development
  • kenrkenr Member
    Thanks for this. I'll keep you informed of progress.
    Ken
  • argoolsbee Member
    edited July 2015
    This is very disappointing. I backed Viper specifically to use it with my Udoo Quad. You even list Udoo compatibility on your homepage, but I had to search and find this thread to find out what has been advertised since the Kickstarter, is not completely accurate.

    I tried the steps above, but got this error:
    ubuntu@udoobuntu: ~/Viper/ide $ python viper-ide.py
    Traceback (most recent call last):
      File "viper-ide.py", line 22, in <module>
        from ide import viper
    ImportError: No module named ide


  • floydfloyd Member
    This is very disappointing. I backed Viper specifically to use it with my Udoo Quad. You even list Udoo compatibility on your homepage, but I had to search and find this thread to find out what has been advertised since the Kickstarter, is not completely accurate.

    I tried the steps above, but got this error:
    ubuntu@udoobuntu: ~/Viper/ide $ python viper-ide.py
    Traceback (most recent call last):
      File "viper-ide.py", line 22, in <module>
        from ide import viper
    ImportError: No module named ide


    Hi argoolsbee,
    The Viper team is working hard to release all the kickstarer announced features before the end of the Viper Beta.
    We are also working with the Udoo Team for trying to simplify the Udoo usage in Viper and maybe also include the support for the new Udoo Neo.
    Please, stay tuned, we'll keep you posted!  ;)
    D.
    Daniele Mazzei
    Zerynth Chief System Architect
  • kenrkenr Member
    floyd said:
    This is very disappointing. I backed Viper specifically to use it with my Udoo Quad. You even list Udoo compatibility on your homepage, but I had to search and find this thread to find out what has been advertised since the Kickstarter, is not completely accurate.

    I tried the steps above, but got this error:
    ubuntu@udoobuntu: ~/Viper/ide $ python viper-ide.py
    Traceback (most recent call last):
      File "viper-ide.py", line 22, in <module>
        from ide import viper
    ImportError: No module named ide


    Hi argoolsbee,
    The Viper team is working hard to release all the kickstarer announced features before the end of the Viper Beta.
    We are also working with the Udoo Team for trying to simplify the Udoo usage in Viper and maybe also include the support for the new Udoo Neo.
    Please, stay tuned, we'll keep you posted!  ;)
    D.

  • kenrkenr Member
    argoolsbee
    Can you copy your tools.py and my_udoo.py files to this discussion. Or paste the text changes into a comment.
    I have done all of the steps for Udoo but cannot viperize my Udoo due. I get no error messages, just a quick end to the upload.
    I can communicate to the due when I try to upload a sketch. But it always returns no ViperVM.
  • floydfloyd Member
    are you resetting the UDOO manually by using the dedicated jumper?
    In order to upload a Viper script, the Arduino side have to be reset and on the Udoo this can't be done directly be serial connection so it requires a manual jumper shortcutting.

    here a snap from another post that report this in detail:
    using the VIPER IDE on your pc connected to the arduino part of Udoo. Follow the instructions here: http://www.elinux.org/UDOO_programming_the_embedded_Arduino_microcontroller  (ignoring the arduino ide patch) and viperize the Udoo. Arduino Due on the Udoo differs from a normal Arduino in the fact that, when you open the serial port, it doesn't reset itself. So it must be reset manually by fiddling with the J16 jumper. So before uploading bytecode to the viperized Udoo, a manual reset is needed. 

    Daniele Mazzei
    Zerynth Chief System Architect
  • kenrkenr Member
    floyd
    If you use the modified bossack provided by Udoo it carries out the SAM clear and reset via the serial line. This works with the Arduino 1.5.6 IDE on the Windows 7 PC I am using, allowing me to upload Arduino sketches without fidling with the J16 etc. jumpers. Ergo I'm able to upload to the Udoo Due without messing with the jumpers as if it was a normal Due.

    I find the elinux.org site is quite often out of date or incorrect. I think the best source for this information is at http://www.udoo.org/tutorial/program-udoos-arduino-processor-external-pc.

    I have modified the Viper IDE as Giacomo suggested. The Udoo Due processor now appears in my boards dropdown.
    I stll cannot Viperize the board. I suspect that the script that Viperizes the board is not selecting the new bossack. If I name the new board as 'Udoo Due' it does not show any available Viper uploads in the dropdown. I have to name it an 'Arduino Due' to get an upload to appear. I will continue to experiment.

    I'm wondering if I'm having the same issue with Windows 7 as reported in another thread?
    I will try replacing my Viper suite with the latest download.

    I'm getting an Arduino Due this week and a Particle Photon is due in August.
    As I get the boards I will be able to start and use Viper.

    As regards the Udoo, I suspect I will have to wait till Viper resolves the issues with Udoo. Lets hope its sooner rather than later.

    Ken
  • floydfloyd Member
    Cool! We'll try to add this on update 8 or 9. Stay tuned :)
    Daniele Mazzei
    Zerynth Chief System Architect
  • kenrkenr Member

    Update ...

    Got my 'Sainsmart' Due clone today.

    Connected and Viperized, no problem. Can upload and run examples. V impressed.

    Can now continue with Udoo Due investigations knowing the Windows 7 environment is communicating OK from Viper IDE.

  • floydfloyd Member
    Cool! keep us posted!
    Daniele Mazzei
    Zerynth Chief System Architect

  • I have modified the Viper IDE as Giacomo suggested. The Udoo Due processor now appears in my boards dropdown.
    I stll cannot Viperize the board. I suspect that the script that Viperizes the board is not selecting the new bossack. If I name the new board as 'Udoo Due' it does not show any available Viper uploads in the dropdown. I have to name it an 'Arduino Due' to get an upload to appear. I will continue to experiment.

    To have Viper VMs show up in the Viperize menu you need to set "board" as "arduino_due" in your my_udoo.py. Also you need to change the runcmd parameters to "bossac_udoo"

    Here is a hopefully working my_udoo.py  file:

    import _board
    import time
    class Udoo(_board.Board):
        ids_vendor = frozenset(("2341",))  #change this to Udoo vendor
        ids_model  = frozenset(("003D",))  #change this to Udoo model
        board = "arduino_due"
        desc = "Udoo"
        ram = 96
        flash = 512
        family_name = "atmelSAM3X"
        manual_reset = 0

        @staticmethod
        def devmatcher(dev):
            mth = dev["devstring"].lower()
            return "arduino" in mth and "due" in mth   #change this to udoo serial string
        def reset(self):
                if self.plt.startswith("win"):
                    self.runcmd("stty",str(self.port)+":115200,n,8,1",shell=True)
                else:
                    self.runcmd("stty",self.port,"cs8 115200")
        def burn(self,bin):
                fname = self.cmdr.get_temp_file(bin)
                if self.plt.startswith("win"):
                    self.runcmd("stty",str(self.port)+":1200,n,8,1",shell=True)
                    time.sleep(1)
                    res,out= self.runcmd("bossac_udoo","-U false -e -w",fname,"-R --boot=1 -p "+self.port)
                else:
                    self.runcmd("stty",self.port,"cs8 1200 hupcl")
                    time.sleep(1)
                    res,out= self.runcmd("bossac_udoo","-U false -e -w",fname,"-R --boot=1")
                
                self.cmdr.del_temp_file(fname)
                if res:
                    return out
                return ""
        def __init__(self,device):
            super().__init__(device)
            self.gcc = "arm"
            self.gccopts = {
                "cflags": ["-mcpu=cortex-m3","-mthumb", "-O2","-fomit-frame-pointer","-falign-functions=16","-ffunction-sections", "-fdata-sections", "-fno-common", "-Wall", "-Wextra", "-Wstrict-prototypes","-nostdlib"],
                "defs": ["ATSAM3X8E","SAM3X_VHAL"]
            }
            
    addBoard = _board.addBoardFun(Udoo)


    Not tested yet, but should solve some of your issues. You need to set "bossac_udoo" to the correct path in tools.py. Also, the calls to "stty" may be not needed (I should actually check what the patched bossac really does)

    Many thanks for the link you posted! It may actually be the solution.
    Here is the idea:
    - the Viper IDE calls a board.reset() method before attempting to upload code for boards with manual_reset==0. In the case of Arduino Due such method just reset port parameters (it is not really needed actually, it just prevents some weird serial behaviour in some systems)
    - For Udoo we could define a reset method that calls "bossac_udoo -R". That should just reset the board
    - Then, the normal flow (open serial port, find VM, uplink code) should go without errors. 

    Giacomo Baldi
    Zerynth Head of Software Development
  • kenrkenr Member

    Still cannot Viperize.

    Used your script...

    Changes in my_udoo.py :

    ids_vendor = frozenset(("10C4",))  #change this to Udoo vendor
    ids_model  = frozenset(("EA60",))  #change this to Udoo model

    return "silicon" in mth and "labs" in mth   #change this to udoo serial string

    Addition to tools.py:

    tools["bossac_udoo"]=os.path.abspath(os.path.join("tools",platform+nbits,"bossac","bossac_udoo.exe"))

    Board appears OK in dropdown.

    Viperize now shows "arduino_due_0.2.0.0007"

    Takes longer to do the upload, but when trying to upload a script still shows no Viper VM version being returned.


  • Ok,

    I think the viperization is ok.  To check for viperization you have to open a serial connection to the Arduino part, reset manually by J16 and type a capital "V" on the serial monitor (putty or your preferred one). The VM should answer with a header.

    The problem is that in a normal Arduino Due, when you open a serial connection to the programming port, a reset signal is triggered and the Arduino restarts. This way the Viper Uploader can chat with the Viper VM and uplink the bytecode. 

    The Arduino part on the Udoo however, is not reset when the serial is opened, so the Uploader can't chat with the VM properly (there is 2 or 3 seconds of timeout after reset and then the VM stops listening for an uplink request), hence the message "expected xxx found None".

    There are two possible solutions. The very-ugly-one is to connect a button to the J16 jumper of the Udoo, change manual_reset to 1  in my_udoo.py, and reset the Udoo when requested by the IDE. Maybe timings must be adjusted to let it work properly. The ideal-but-not-tested solution is to use bossac_udoo to reset the Arduino part before opening the serial port. I think bossac_udoo with the -R option may work, but I am not sure. I was reading this and looking at the bossac_udoo patch to understand if the Arduino is only restarted or also erased. I may be able to try in the next week.
    Giacomo Baldi
    Zerynth Head of Software Development
  • kenrkenr Member
    Giacomo
    This might be useful ...
    Github TomFreudenberg/udoo-arduino-cli.
    This could reset the due from Udoo Linux.
    Will try over the weekend.


  • Good news,

    0008 will have support for Udoo  B)  (many thanks to Kenr!!)

    I read the Udoo manual in depth, the repository pointed out in this thread and some other material. The result is, Udoo boards can't be easily integrated in the Viper IDE with a smooth user experience. Therefore I came up with a trick, tested it and it works nicely:

    1. Boot up Udoo with a udoobuntu distro
    2. To viperize the Udoo, just remove J18 and click viperize in the IDE, works out of the box
    3. To upload code, run a script on the Udoo board that act as a network serial port. It needs to be run just once, or better, set to be run during udoobuntu startup sequence.
    4. Click upload in the IDE and the Udoo works as an Arduino Due
    The script to be run on the Udoo, sits there waiting from an incoming connection from the IDE. Once the connection is made, it resets the Sam3X, opens the serial port and send everything it receives from the IDE to the Sam3x. Done.
    The only thing needed is for the Udoo board to be connected to the same network where the IDE resides.

    Cya soon for the update!

    Giacomo Baldi
    Zerynth Head of Software Development
  • kenrkenr Member
    Great. Looking forward to the update.
  • kenrkenr Member
    have now Viperised my Udoo and uploaded the 'Hello Viper' script by following the instructions in the relevant Supported Boards section of the Docs.

    Points:

    1. Needed to download the Python-serial module to Udoo before the terminal window stayed open.
    2. Nice that the Terminal in Viper IDE connects to the Udoo whilst the start.sh is still running.

    Great work.

    Can't wait till the Photon wifi driver comes so that I can test with ViperApp. In the meantime on with the IOT shield testing on the Due, Udoo and Photon.

    Thanks Giacomo for all your hard graft.

  • kenrkenr Member
    Giacomo

    Just an observation ....
    I noticed that the port shown in the Viper Bridge terminal window increases everytime I connect the Terminal in the Viper IDE. Is this coming from the Viper IDE or the Viper Bridge and is it intentional?
  • Hi kenr and thanks!

    From memory I guess the port number printed by the Viper Bridge is the port of the incoming socket (the one opened by the Viper IDE), so yes it changes everytime you uplink or open the console. As for it increasing, it depends on the policy of the operative system. 

    About your first point...that's very important. I guess I installed pyserial on my udoobuntu and then forgot about it. I'll update the docs asap.
    Giacomo Baldi
    Zerynth Head of Software Development
  • vinny74 Member
    It does not work, the board is not identified as Arduino Due

    P.S. This is an on-line translation
Sign In or Register to comment.

ZERYNTH Community

@ 2016 Zerynth.com, all rights reserved.