Pages: [1] 2 3   Go Down
Author Topic: Bootloader without turning pins on/off when booting up  (Read 2438 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey all is there any bootloader for the Nano 328 that's just like the stock bootloader but modified so that when power is applied or reset it do not turn on all the digital/analog pins on/off?

Thanks!

David
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 209
Posts: 13027
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The bootloader touches three pins: TX, RX, and digital pin 13.

Are you asking for a bootloader that does not blink the LED on pin 13?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When the uC is reset, all IO pins go to INPUT state until the sketch set them to outputs as needed.
I don't think you can avoid that.
Maybe you want to go bootloaderless and have your sketch start immediately upon reset,  and be able to call your pinModes faster for the outputs.
Or used DDR to set them as outputs followed by PORTx commands to set them high low.
Could probably have that as the first couple of lines in void setup.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the reply's so far.

The reason i am needing to do this is because i have a 8 port relay board connected to A0, A1, A2, A3, A4, A5, D12 & D11. Hooked up to 4 of those relay outputs are my garage door switches so when the power is applied to the arduino they all (the relays) blink and cause my garage door to either open or close... That's not a good thing if the power goes out and comes back on and my garage door opens when i am not at home...

How would one use the IDE with no bootloader? I figured the bootloader that is shipped with the Arduino is what allows it to be used in the IDE?
Logged

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 129
Posts: 8592
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless they are pulled to a safe level those pins are floating for a while after the board is powered up, they could then do anything and you relay board will follow suite. If the board uses any form of latched logic you are in trouble.

Do you have a schematic of the relay board?

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To use the board with no bootloader:
Connect a programmer such as Atmel AVR ISP MKii to the ICSP header and use
File:Upload Using Programmer

You could also add 5K or 10K pullup or pulldown resistors to the IO pins to pull them up or down and prevent floating and false switching.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the board:


They seem to all flash the relay board a few times when the ardunio restarts or has power applied to it.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To use the board with no bootloader:
Connect a programmer such as Atmel AVR ISP MKii to the ICSP header and use
File:Upload Using Programmer

You could also add 5K or 10K pullup or pulldown resistors to the IO pins to pull them up or down and prevent floating and false switching.



And after doing so would it still allow me to program and send it over to the arduino through the IDE?

As for the resistors.... the relays turn on when 5v are applied to it. So i am guessing that i would need to have pull down resistors to prevent that from happening, correct?

Also, would this work just as well as the Atmel AVR ISP MKii?


http://microcontrollershop.com/product_info.php?products_id=4541
« Last Edit: November 05, 2012, 09:40:56 am by StealthRT » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"would it still allow me to program and send it over to the arduino through the IDE?"

"File:Upload Using Programmer" is part of the IDE.
It is just a different path for getting programs into the uC - instead of the Serial Rx/Tx pins, it uses the SPI pins.
You connect a AVR ISP to the board instead of using the onboard USB/Serial adapter.

Yes, sounds like you need pull down resistors.

Pocket Programmer - possibly. Some of them have problems loading to the larger chips like the '2560, but only for really large programs.
I have no experience with it - browse the forum for issues, or wait to see if someone else comments on it.
Or check the source website - that is a Sparkfun, or maybe an Adafruit design?
« Last Edit: November 05, 2012, 09:46:57 am by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Schematic says Limor Fried - so that's an Adafruit.com sourced part.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 129
Posts: 8592
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How come the power supply is coming from an Android but the control signals from an Arduino?

That board uses optocouplers to drive the relays, pull downs would be a good bet but a schematic would be helpful.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Full Member
***
Karma: 0
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"would it still allow me to program and send it over to the arduino through the IDE?"

"File:Upload Using Programmer" is part of the IDE.
It is just a different path for getting programs into the uC - instead of the Serial Rx/Tx pins, it uses the SPI pins.
You connect a AVR ISP to the board instead of using the onboard USB/Serial adapter.

After uploading the bootloader then can i switch back to the USB since my program sends commands/listens to the Arduino serial?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless they are pulled to a safe level those pins are floating for a while after the board is powered up, they could then do anything and you relay board will follow suite. If the board uses any form of latched logic you are in trouble.

Do you have a schematic of the relay board?

Not true about the possibility of floating input condition. Most of those asian relay boards use a 'current loop' input through the optoisolators input led and are an active low input to turn on the relay (arduino output pin needs to be set to LOW to turn on a relay), so only a +5vdc wire (from the arduino) and a wire(s) from the arduino output pin(s) need to be wired to the relay board to operate the channels, no pull-up or pull-downs required and no arduino ground wire is needed to just operate the optoisolator channels. However the relay board itself does require +5vdc and ground to power the relay coils so if one is going to power the relay coils with the arduino's +5vdc voltage source then a ground is also required from the relay board to a arduino board. However that defeats the advantage of having optoisolators in the first place, so that is rather strange. However most of these relay boards I've seen have a jumper clip so that if the jumper is removed The arduino's +5vdc is not wired to the relay coil circuit but just to the optoisolators input led pins, so you are then free to use an external source of +5vdc voltage to provide power for the relay coil circuits and take full advantage of the isolation properties of the optoisolators.

Also if your going to be using the android's +5vdc to power the relay board then you must also connect the androids ground to the arduino ground for the opto input circuits to work properly, that is probably the source of your problems.

Here is a a typical asian relay board (a single channel version) which has a schematic drawing that should show better what I was trying to explain above.  http://www.ebay.com/itm/251061549983?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649

Lefty

_____
Rob
« Last Edit: November 05, 2012, 11:46:32 am by retrolefty » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"After uploading the bootloader then can i switch back to the USB since my program sends commands/listens to the Arduino serial?"
After  uploading your sketch via "File:Upload Using Programmer" your sketech will run the same as if you had uploaded in the  normal manner - so if it communicated with the PC before, it will continue to do so.
It will just not uoload sketches via the serial port, until you re-install a bootloader. It will start the sketch immediately after a reset.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 129
Posts: 8592
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, so regardless of the voltages there will be no current flowing until the pins are set to outputs.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1] 2 3   Go Up
Jump to: