Can't get Arduino examples to work (possibly PEBKAC?)

Discussion in 'Arduino IDE' started by chrisib, Jul 31, 2014.

  1. chrisib

    chrisib New Member

    Joined:
    Jul 31, 2014
    Messages:
    2
    Likes Received:
    0
    Before I go too far, I'm pretty sure this is just a PEBKAC ("Problem Exists Between Keyboard and Chair") error, and not a hardware issue. But I could be mistaken.

    I just tried booting up and using my Udoo for the first time (I've had it for a year or so, but kept getting distracted). Unfortunately I can't seem to get the Arduino examples to work on the Udoo. They compile and upload to the Arduino just fine, but then they don't seem to actuall *do* anything. The blink example doesn't appear to flash an LED anywhere on the board (is there even an LED to flash?), and the two serial communication examples I've tried don't seem to actually send/receive any data (I've tried using GTKterm as well as the built-in serial monitor in the Arduino IDE).

    Setup:
    I've got the Arduino IDE 1.5.7 installed and patched on my laptop (running Ubuntu 14.04). I've removed the J18 jumper and connected the programming port to my laptop's USB port.

    Inside the Arduino IDE I have "Due (Programming Port)" selected for the board, and /dev/ttyUSB0 as the port. When I click "upload" after opening the example the output at the bottom indicated success:
    Code:
    Sketch uses 10,788 bytes (2%) of program storage space. Maximum is 524,288 bytes.
    Erase flash
    Write 11924 bytes to flash
    
    [                              ] 0% (0/47 pages)
    [======                        ] 21% (10/47 pages)
    [============                  ] 42% (20/47 pages)
    [===================           ] 63% (30/47 pages)
    [=========================     ] 85% (40/47 pages)
    [==============================] 100% (47/47 pages)
    Verify 11924 bytes of flash
    
    [                              ] 0% (0/47 pages)
    [============                  ] 42% (20/47 pages)
    [===================           ] 63% (30/47 pages)
    [=========================     ] 85% (40/47 pages)
    [==============================] 100% (47/47 pages)
    Verify successful
    Set boot flash true
    CPU reset.
    FINE DELLE OPERAZIONI.
    After this the Arduino just sits there and does nothing. I've tried hitting the reset button, but that didn't do anything.

    As I said before, I've tried the Blink example (but I don't even know if there's an LED to blink), and I tried two serial examples. For both of the serial examples I tried using the serial monitor as well as GTK term to send/receive data. The port and baud rate appear to be configured properly in both cases. Do I need to change which port on the Arduino my USB cable is connected to? (I tried this briefly, but when connecting the other USB port dmesg didn't indicate that it registered anything being connected.)

    Do I need to (re)move additional jumpers, or change USB cable ports to get the UDOO <--> external PC communication working? And is there an LED that can be controlled by the Arduino on the board anywhere (and if so do I need to change the example code to set the correct pin)?

    This is my first time working with Arduino boards, but I do have a fair bit of experience working with other embedded systems (mostly AVR boards, working with avr-gcc and either avrdude or sending raw binaries to the bootloader with gtkterm). I suspect that the issue is with me and just doing something wrong/not knowing enough about how Arduinos are supposed to work.

    If anyone can point me in the right direction I'd really appreciate it. Thanks a lot for the help!
     
  2. extream96

    extream96 New Member

    Joined:
    Jun 27, 2014
    Messages:
    48
    Likes Received:
    0
    Hi,
    UDOO don't have a led on the board, so the sketch don't do nothing because there isn't a led.
    If you want to use a blink, you connect a led in udoo.
    If you post the code of the serial example, i can understand better because doesn't works!
    However if you wont try a simple code, you can try this:
    void setup()
    {Serial.begin(9600);
    }
    void loop()
    {Serial.println("Hello");
    delay(500);
    }

    You open the serial monitor in the arduino ide with 9600
     
  3. chrisib

    chrisib New Member

    Joined:
    Jul 31, 2014
    Messages:
    2
    Likes Received:
    0
    Good to know about the LED. I saw there was a single LED on the Udoo, but I had no idea if it was actually connected to the Arduino or not.

    As for the serial, here's the code for one of the two examples I was trying out:

    Code:
    /*
      ASCII table
    
     Prints out byte values in all possible formats:
     * as raw binary values
     * as ASCII-encoded decimal, hex, octal, and binary values
    
     For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
    
     The circuit:  No external hardware needed.
    
     created 2006
     by Nicholas Zambetti
     modified 9 Apr 2012
     by Tom Igoe
    
     This example code is in the public domain.
    
     <http://www.zambetti.com>
    
     */
    void setup() {
      //Initialize serial and wait for port to open:
      Serial.begin(9600);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }
    
      // prints title with ending line break
      Serial.println("ASCII Table ~ Character Map");
    }
    
    // first visible ASCIIcharacter '!' is number 33:
    int thisByte = 33;
    // you can also write ASCII characters in single quotes.
    // for example. '!' is the same as 33, so you could also use this:
    //int thisByte = '!';
    
    void loop() {
      // prints value unaltered, i.e. the raw binary version of the
      // byte. The serial monitor interprets all bytes as
      // ASCII, so 33, the first number,  will show up as '!'
      Serial.write(thisByte);
    
      Serial.print(", dec: ");
      // prints value as string as an ASCII-encoded decimal (base 10).
      // Decimal is the  default format for Serial.print() and Serial.println(),
      // so no modifier is needed:
      Serial.print(thisByte);
      // But you can declare the modifier for decimal if you want to.
      //this also works if you uncomment it:
    
      // Serial.print(thisByte, DEC);
    
    
      Serial.print(", hex: ");
      // prints value as string in hexadecimal (base 16):
      Serial.print(thisByte, HEX);
    
      Serial.print(", oct: ");
      // prints value as string in octal (base 8);
      Serial.print(thisByte, OCT);
    
      Serial.print(", bin: ");
      // prints value as string in binary (base 2)
      // also prints ending line break:
      Serial.println(thisByte, BIN);
    
      // if printed last visible character '~' or 126, stop:
      if (thisByte == 126) {    // you could also use if (thisByte == '~') {
        // This loop loops forever and does nothing
        while (true) {
          continue;
        }
      }
      // go on to the next character
      thisByte++;
    }
    I opened up the serial monitor, made sure the baud rate (and parity, etc...) was correct, reset the Arduino, and nothing. Same results when trying with GTKterm.

    I left my Udoo in the lab last night so I can't test out anything until next week, but I'll try a serial print-spam program like you suggested ASAP. Thanks for the help.
     
  4. extream96

    extream96 New Member

    Joined:
    Jun 27, 2014
    Messages:
    48
    Likes Received:
    0
    The code that you have posted should be correct, but i can't test it because now i don't have udoo, i will test it.
    When you can, you test my code or another code and tell me if arduino works!
     
  5. udoo_usr

    udoo_usr New Member

    Joined:
    Aug 5, 2014
    Messages:
    2
    Likes Received:
    0
    Looking at the code you posted, I suspect the output you are expecting is on TX1 (pin 4, counting from bottom up) on terminal block J5. This appears to be the first UART pair (TX1 - pin 4 / RX1 - pin 3) on the UDOO board. In order to see the serial data on this pin you'll need to probe this pin with your logic signal analyzer (assuming you have one) or somehow feed what's on this pin back to the serial monitor in the Arduino IDE. Hope this helps. Good Luck.
     
  6. extream96

    extream96 New Member

    Joined:
    Jun 27, 2014
    Messages:
    48
    Likes Received:
    0
    If you use a serial monitor of the arduino ide, for a simple test, you can see the output of the code.
     

Share This Page