PORTD as output = brick?

I am making an LED cube but controling it with my arduino would require using PORTD as an 8-bit data output. (As in Cher's example program)

However, since pin 0 is in port D and it usually receive serial programming as an input pin, doesn't this mean I'll never be able to reprogram my arduino again? Is there any way around this?

Thanks!

doesn't this mean I'll never be able to reprogram my arduino again?

No, you still can reprogram your Arduino.

That said, if you don't need the Serial pins, don't use them, they are allways usefull for debugging etc

Unfortunately port D is the only one with all 8 pins usable. So I'll be able to reprogram the arduino normally via the USB even if i set PORTD, including pin 0, as output in my program? How does that work?

So I'll be able to reprogram the arduino normally via the USB even if i set PORTD, including pin 0, as output in my program? How does that work?

Yes, when uploading a new sketch the bootloader takes care of the communication, overruling the sketch on board ..

[quote author=Vick Jr link=topic=69258.msg512993#msg512993 date=1313253288] So I'll be able to reprogram the arduino normally via the USB even if i set PORTD, including pin 0, as output in my program? [/quote] The FTDI chip may not be able to drive pin 0 high if a load (LED ?) is also connected and if so, serial programming will not work and you may damage the FTDI chip. If the pin is used as a control signal, you're not likley to see any issue. If the pin is used to source power to a LED however, your concerns are valid.

The FTDI chip may not be able to drive pin 0 high if a load (LED ?) is also connected and if so, serial programming will not work

Correct, because of the series 1k ohm resistor from the FTDI output pin to the arduino rec pin, the FTDI will not be able to overcome very much of any additional load burden from external components like an LED/resistor wired to pin 0.

and you may damage the FTDI chip.

Not likely, those 1k ohm isolation resistors will pretty much protect the FTDI chip from damage.

Lefty

retrolefty: Not likely, those 1k ohm isolation resistors will pretty much protect the FTDI chip from damage.

True, my concern is if you bypass the 1k resistor as max current for the FTDI chip is 16mA. This would be within spec for the Arduino, but "unhealthy" for the FTDI chip.

True, my concern is if you bypass the 1k resistor as max current for the FTDI chip is 16mA. This would be within spec for the Arduino, but "unhealthy" for the FTDI chip.

Unhealthy for sure. If one was using pin 0 as a output pin and set it low, without the resistor, the FTDI pin and Arduino pin would be both seeing a short circuit from Vcc to ground through both pins. The 1K resistors are a requirement for any arduino compatible design that has a FTDI or 8u2 converter wired to pins 0 and 1.

Lefty

The solution is quite simple: get an ISP. If you get the right one, you won't have to spend a fortune either.

End of story.

Here are 2 solutions:

  1. Disconnect the LED/resistor from pin 0 when you want to upload a program. Then reconnect it when you want to run the program.

  2. Drive the LED using a transistor or small mosfet (e.g. 2N7000) so that the load is small and the 1K series resistor can easily drive it during programming.

PORTD will be a 8-bit data bus to control a latch array, so I think pin 0 will only have small signal currents. It's not driving any load directly.