Go Down

Topic: Direct port D use and programming the Arduiono Nano (Read 109 times) previous topic - next topic


Quick question (I hope).

Will I brick (or disable uploading sketches) an Arduino Nano if I use direct port access on port D (8 bits, all as outputs)?

I haven't meddled with Arduino for quite a few years, so I'll need to relearn a few things. I just thought I'd throw this question out here first, just in case.

From reading the page about port registers, it has a warning about receiving serial communications being disabled if setting D0 as output.

I don't plan on using the serial comms, except ofc when uploading a program ("sketch"). Hence my little worry. I'm guessing the bootloader will reset this, and that pressing reset will probably be required to do if D0 is not working as serial comms. If so, that'll be fine.

From the schematics of the Nano I see the Rx / Tx pins go through 1k resistors to the USB chip, so I'm aware I have to take that into account.


No. The Nano's reset pin is coupled to the DTR line of the on-board serial adapter through a 0.1uF cap - this is the "DTR autoreset" mechanism; it resets the board when a serial connection is opened (which causes DTR to be driven low - the cap is used to convert the transition to a pulse), thus insuring that whatever your code does, it will always be reset, allowing the bootloader to run and a new sketch to be uploaded.

It's only boards with native USB where bad code can make it more difficult to load a new sketch.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy



It's only boards with native USB where bad code can make it more difficult to load a new sketch.
Or use of short WDT timeouts ?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up