[Solved] Uploading a Sketch & Serial Port issue

Discussion in 'Arduino IDE' started by josolanes, Oct 16, 2013.

  1. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    Hi,

    I just received my UDOO Quad and am running the most recent SD Image for Ubuntu (udoo_quad_ubuntu_1.2.zip) that was released yesterday, Oct 15. This image comes with the Arduino IDE

    I'm having trouble actually uploading sketches to the embedded DUE from the UDOO, though. I have programmed Arduinos (UNO and Mega2560) from within Windows 7 and Mac OS but never in Linux and I suspect that's where my problem must lie. I have used Linux before and am comfortable in Linux, but I don't know where to look to resolve the issue I'm having

    As the board was when I received it (no moving pins or adding shields), if I try to upload the "BareMinimum" sketch I get this in the Arduino IDE console:
    Code:
    /opt/arduino-1.5.4/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
    sbrkr.c:(.text._sbrk_r+0xc): warning: undefined reference to `_sbrk'
    
    Sketch uses 12,012 bytes (2%) of program storage space. Maximum is 524,288 bytes.
    
    Inner erase and reset routine:  successiful!!
    Erase flash
    Write 14192 bytes to flash
    
    [                              ] 0% (0/56 pages)
    [=====                         ] 17% (10/56 pages)
    [==========                    ] 35% (20/56 pages)
    [================              ] 53% (30/56 pages)
    [=====================         ] 71% (40/56 pages)
    [==========================    ] 89% (50/56 pages)
    [==============================] 100% (56/56 pages)
    Verify 14192 bytes of flash
    
    [                              ] 0% (0/56 pages)
    [=====                         ] 17% (10/56 pages)
    [==========                    ] 35% (20/56 pages)
    [================              ] 53% (30/56 pages)
    [=====================         ] 71% (40/56 pages)
    [==========================    ] 89% (50/56 pages)
    [==============================] 100% (56/56 pages)
    Verify successful
    Set boot flash true
    CPU reset.
    The only things added to the UDOO are an ethernet plug (confirmed wifi and ethernet both work well), USB mouse and USB keyboard, and HDMI out to my TV used as a display for Ubuntu. The rest works well.

    Here is my output to confirm the Arduino is showing up within Linux:
    Code:
    ubuntu@imx6-qsdl:~$ dmesg | grep mxc3
    [    1.694779] imx-uart.3: ttymxc3 at MMIO 0x21f0000 (irq = 61) is a IMX
    ubuntu@imx6-qsdl:~$ 
    If I try to run a Serial Monitor within the Arduino IDE I get:
    Code:
    Serial port '/dev/ttymxc3' not found. Did you select the right one from the Tools > Serial Port menu?
    There is no Tools->Serial Port but there is Tools->Port (which is greyed out). So maybe there is an issue where I should move pins around on the board? If so, which ones and where? From reading it seems J18 should be removed if you intend on programming the DUE using an external computer via the micro-usb connectors, correct? In which case J18 stays to allow embedded programming?

    I'd appreciate help on this - I'm eager to begin programming the embedded DUE to put it to work! :)

    Also, for anyone interested, I'm running my UDOO on a 32GB Class 10 MicroSD without issue and have resized the flashed partition to the full size of the card successfully using GParted Live CD. I've also installed the Synaptic package manager that normally comes with Ubuntu and have created a 2GB swap file in the SD Card to assist with extra memory allocation - though, it is slow when needed, at least the UDOO continues through it without crashes :)
     
  2. ekirei

    ekirei Administrator

    Joined:
    Jun 14, 2013
    Messages:
    78
    Likes Received:
    3
    Re: Uploading a Sketch

    Hi josolanes,

    It seems that you're not having trouble uploading the sketch, which is working properly from what comes from the Arduino IDE console.
    The problem you experienced is a serial monitor issue, it's a common problem.

    To solve this open a terminal in UDOO and create a symbolic link to the internal serial port (/dev/ttymxc3) with this command:

    Code:
     sudo ln -sf /dev/ttymxc3 /dev/ttyS0
    In this way the Arduino IDE will see the port and you can open the serial monitor.

    This is only a workaround, you have to redo this operation everytime you boot the OS on UDOO or alternatively put the above command (without "sudo") in the file /etc/rc.local before the line "exit 0".

    With the next release of Ubuntu this issue will be fixed.

    Thanks for your contribution in debugging UDOO!

    ekirei
     
  3. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    ekirei,

    Thank you very much for the fast reply - I'll try it later to confirm, but that sounds like it's got to be it!

    I'll add it to the local.rc file to ensure it occurs on each boot :)

    Thanks again ekirei, and I'm glad to be part of the debugging - it's exciting getting to play with such a new (and flexible) piece of hardware :)
     
  4. evilpengw1n

    evilpengw1n New Member

    Joined:
    Oct 21, 2013
    Messages:
    26
    Likes Received:
    0
    Are there any examples on how to communicate to the serial from the kernel to the SAM3?

    My sketch:
    Code:
    byte number = 0;
    
    void setup(){
      Serial.begin(9600);
    }
    
    void loop(){
      if (Serial.available())  {
        number = Serial.read();
        Serial.print("character recieved: ");
        Serial.println(number, DEC);
      }
    }
    
    And from the Udoo:
    Code:
    minicom -b 9600 -o -D /dev/ttyS0
    where /dev/ttyS0 is a symlink to /dev/ttymxc3
     
  5. evilpengw1n

    evilpengw1n New Member

    Joined:
    Oct 21, 2013
    Messages:
    26
    Likes Received:
    0
    Got it, turns out I have to remove J18 to upload via a different pc, but I have to return J18 before the SAM and the i.MX can communicate via the baud rate
     
  6. josolanes

    josolanes New Member

    Joined:
    Oct 14, 2013
    Messages:
    64
    Likes Received:
    0
    Thanks for the additional information @evilpenw1n :)


    And I confirmed that creating a symlink fixed it and it opened the serial port (and was listed in the IDE) without issue then
     
  7. joemcder

    joemcder New Member

    Joined:
    Oct 21, 2013
    Messages:
    17
    Likes Received:
    0
    That was a good tip on creating the link /dev/ttyS0. Now the Arduino Monitor screen works correctly.

    I noticed that the Arduino IDE mentions 2 'boards',
    1.Arduino Due (Programming Port)
    2.Arduino Due (Native USB Port)

    They both work but what is the difference? Can we use the ''Native USB Port" to cummunicate at higher speeds than 115200 baud?

    By the way, here is a dumb question. I wanted to start a new topic but did not see the 'New Topic' button. Am I blind or do I have to sacrifice two chickens to obtain the permissions :)
     
  8. dmedine

    dmedine New Member

    Joined:
    Jul 13, 2013
    Messages:
    3
    Likes Received:
    0
    hmmm. I have a dual core revD and the symbolic link workaround doesn't seem to work for me at all. Thoughts?
     
  9. dmedine

    dmedine New Member

    Joined:
    Jul 13, 2013
    Messages:
    3
    Likes Received:
    0
    huh. tried the ln-sf command again. Now it works.
     
  10. r4v5

    r4v5 New Member

    Joined:
    Jun 19, 2013
    Messages:
    6
    Likes Received:
    0
    Re: Uploading a Sketch

    Couldn't a udev-rule be created to do this? I'll look at creating one when my board is unpacked if that hasn't already been done as the aforementioned fix on the default images.
     
  11. ekirei

    ekirei Administrator

    Joined:
    Jun 14, 2013
    Messages:
    78
    Likes Received:
    3
    Hi guys,

    for make the Arduino IDE able to directly see the internal serial /dev/ttymxc3, without using a symlink, we have modified and recompiled the java library used in it.
    you can download the attachment and untar it in the lib/ of the arduino IDE, overwriting files within.
    For example, if you use the UDOO ubuntu 1.2 image with the IDE preinstalled, you can run this command from the folder where you have downloaded the package:

    Code:
    sudo tar -xzvf rxtx-2.2pre1_ek5.tar.gz -C /opt/arduino-1.5.4/lib/
    This patch is already in the Arduino IDE for UDOO downloadable here: http://www.udoo.org/downloads/#tab4
    and will be in the next ubuntu image.
     

    Attached Files:

  12. joemcder

    joemcder New Member

    Joined:
    Oct 21, 2013
    Messages:
    17
    Likes Received:
    0
    In principle there are a number of ways the 2 sides of Udoo can communicate. I hope someone can give examples in the context of Arduino communications. For example, I2C, SPI, or even that hispeed direct USB connection. The fast 32bit Arduino is capable of processing much more data than the old 8bit devices. Correspondingly we will want methods faster than 115kbaud. I also like to reserve the programming port for debugging messages.

    The Arduino crowd seems to be releasing a combined board in Spring'2014 but they are using a 8bit Arduino side. Some have described it as a Beaglebone 'glued' to a Leonardo. Udoo makes more sense with its hi-powered balance of devices and lotsa flexible io pins. We hardware hackers NEVER have enough IO pins.
     
  13. tooblippe

    tooblippe New Member

    Joined:
    Nov 3, 2013
    Messages:
    2
    Likes Received:
    0
    HI,

    I have installed the Arduino IDE for UDOO, and have no problem uploading a sketch. Blink works fine aswell as AnalogReadSerial. I program the Arduino directly from the UDOO.

    1. The problem comes in when I want to send serial data to the Arduino via die Serial Monitor. It just doesn't work. So I can use Screen, cat etc to read continuous streams of information but not send any? Nothing happens also using the Serial Monitor to send. Even when I change to any of the four options (line endings etc). Any tips.



    Also the Arduino does not seem to reset itself when you attach to the serial port.

    Any help will be apreciated

    Tobie
     
  14. jrk

    jrk New Member

    Joined:
    Jan 25, 2014
    Messages:
    30
    Likes Received:
    0
    wow, I'm running into this issue today after using the Due about a week ago. tried the symlink and it doesn't seem to work. Same exact setup and results at original post. It looks like I'm having an issue where after a successful load I can no longer talk to the Due, either from the UDOO iMX6 or from an external computer unless I do J22 and J16 to clear and reset the DUE.
     

Share This Page