1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Arduino startup issues

Discussion in 'Microcontrollers' started by dr pepper, Sep 3, 2017.

  1. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,645
    Likes:
    246
    Location:
    North west UK
    For me this should be simple.
    I have an arduino, it just receives serial data and display it on an lcd.
    The serial stream on the i/p is continuous, and is present before power on.
    At power on the code just hangs, however if I press reset after power on the code runs and the display works just fine.
    So I guess the 'duino doesnt like data on the serial port at power on, maybe its going into programming mode or something.
    I tried flushing the serial buffer after boot, nut nada, I also tried a delay before initing the serial port nothing there either.
    I didnt think there was a difference between power on reset and the reset button.
    Any ideas how I can fix this?, I spose a reed relay or switching tranny might do the trick but I'd rather do something a little more elegant in code.
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,178
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    I have a Ard UNO running with a HC12 RXR, incoming serial data rate of 2secs, of 50 ASCII chrs, it is restarting OK at power boot.

    The other system is a Ard NANO which receives HC12 data, which can get corrupted which causes it to hang, so I have programmed a 12F683 to give a NANO Reset after 60secs, work OK.

    When I am reprogramming the Arduino's I have a simple slide switch in the incoming RX line, else I get Arduino warnings during compile/load.
    E
     
  3. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,206
    Likes:
    640
    Location:
    Derbyshire, UK
    As the Arduino has a serial boot loader, possibly it's entering the boot loader when it finds serial data coming in?.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,253
    Likes:
    961
    Location:
    Loveland, CO USA

    It could be the LCD has not had time to get up and going. Trying to write to the LCD too soon might hand the program.
     
  6. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,645
    Likes:
    246
    Location:
    North west UK
    The code doesnt 'listen' to the lcd, the read/write is permanently tied low, however I did wonder if the 'duino was running & display wasnt, but theres no data transfer according to my logic probe.

    I managed to get the thing to 'work' kinda, I put a tranny which with no i/p pulls the serial pin high, theres a resistor in series with the incoming data, when the 'duino has booted it turns the tranny off with a spare i/o pin, it works but its a bodge, and I still dont know why.
     
  7. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,248
    Likes:
    1,218
    Location:
    Cardiff, Wales
    Dunno about the 'duino, but many ICs do strange things if they have signals on their data pins but no valid power supply. The protection diodes on the data pins allow current to flow into the IC.
     
  8. dr pepper

    dr pepper Well-Known Member

    Joined:
    Oct 6, 2008
    Messages:
    4,645
    Likes:
    246
    Location:
    North west UK
    Yes I dont spose the processor would like being powered up & down 9600 times a second.
     
  9. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,910
    Likes:
    1,095
    In some cases, you can actually power the chip through the I/O pins. You really shouldn't have data present on power up without protection.
    Effectively Vcc=0 and say your input is 5 V. There is a current limit for each pin. So, series resistors or level translators are required.
     
    • Informative Informative x 1
  10. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,794
    Likes:
    134
    Location:
    morristown,tn
    Nope it's being powered the serial to ground is about 4 volts and goes low on most stuff
     

Share This Page