arduino serial problem on "cold start"

Discussion in 'Troubleshooting' started by Sebbe9, Jan 10, 2015.

  1. Sebbe9

    Sebbe9 New Member

    Joined:
    Jan 10, 2015
    Messages:
    2
    Likes Received:
    0
    I have a weird problem with my arduino code that i think is related to the usb to uart bridge. I am sending control values from my pc to the udoo and then sending debug data back. When i upload my sketch and open serial monitor, everything works great, the debug data are being updated when i enter new control values. But if i unplug the udoo and power it on again, it doesnt work, i get the debug data from the udoo like before, but nothing happens when i enter new values, and if i press the reset button, it works for about 5 seconds but then it stops updating the control values.

    I made this simple sketch to test it on my arduino mega 2560 and it works without any issues. Could anyone try this on their udoo? hopefully it works with the internal iMX6 serial connection wich i am going to use for remote control.
    Code:
    int man_roll = 0;
    int man_pitch = 0;
    int man_yaw = 0;
    int man_throttle = 0;
    int man_camera_x = 0;
    int man_camera_y = 0;
    
    uint32_t count = 0;
    uint32_t delt_t = 0;
    
    
    void setup() {
      Serial.begin(115200);
      Serial.setTimeout(5);
    }
    
    void loop() {
      update_rx();
      delt_t = millis() - count;
      if (delt_t > 100) {
        debug();
        count = millis();
      }
    }
    // code to receive controls from my pc.
    void update_rx() {
      if (Serial.available()){
        man_roll = Serial.parseInt();
        man_pitch = Serial.parseInt();
        man_yaw = Serial.parseInt();
        man_throttle = Serial.parseInt();
        man_camera_x = Serial.parseInt();
        man_camera_y = Serial.parseInt();
      }
    }
    // 10 hz loop to send debug data back.
    void debug(){
        Serial.print("Manual Roll:");
        Serial.println(man_roll);
        Serial.print("Manual Pitch:");
        Serial.println(man_pitch);
        Serial.print("Manual Yaw:");
        Serial.println(man_yaw);
        Serial.print("Manual Throttle:");
        Serial.println(man_throttle);
    }
     
  2. Sebbe9

    Sebbe9 New Member

    Joined:
    Jan 10, 2015
    Messages:
    2
    Likes Received:
    0
    i beleive its because when i restart it, the imx6 starts a serial connection with the sam3x, and all i can do is read from the serial bus, does this sound possible?

    edit: i tested it in the IDE on the udoo and it worked great, and since i will be sending data through a script running on the udoo i guess it wont be a problem :)
     
  3. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hi there Sebbe9,
    I think this would help you: http://udoo.org/download/files/Document ... 8_2013.pdf
    Page number 29, Paragraph number 4.3.1.
    The serial line is shared between 3 devices: iMX6, SAM3X, external PC.
    This may be a problem. The external communication is enabled only when you try to program a sketch from an external PC. Otherwise, the driver keeps connected iMX6 and SAM3X.
    Cheers!
     

Share This Page