PD0, PD1 Output Not Working

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This has to be a noob question.

I have some code that toggles PD0, PD1, PD2 high and low. It works with any pins on PORTD except PD0 and PD1.

I know these pins are shared with the USART, but it's off by default and this is the only code in main():

DDRD |= (1 << PD0) | (1 << PD1) | (1 << PD2);

for (;;) {
  PORTD |= (1 << PD0) | (1 << PD1) | (1 << PD2);
  RJCDelay_ms(10);
  PORTD &= ~((1 << PD0) | (1 << PD1) | (1 << PD2));
  RJCDelay_ms(10);
}

Why doesn't this work?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And what AVR model is that?
And what is it "sitting" on?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, I've got an ATMega168 Arduino (actually a Seeeduino). I don't have a true schematic for the board but the pin is directly wired to a header that I have my logic analyzer hooked up to. I don't believe there is anything else hooked up to the pin.

I bought the board fully assembled.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

these pins are shared with the USART

Quote:

I don't believe there is anything else hooked up to the pin.


Your Arduiono has no RS232 or RS485 or other transceiver hooked to the USART pins? Somewhat strange.

Quote:

I bought the board fully assembled.


I'd wager a schematic is available.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guess who's the noob? I downloaded Eagle so I could view the schematic and PD0/PD1 are connected through a 1k resistor to the FT232 UART-USB bridge. So the UART must be enabled through something I'm not familiar with. Looks like more reading for me.

Would this be configured as part of the bootloader, fuses, something else?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

crazyray wrote:
Would this be configured as part of the bootloader, fuses, something else?
Read the datasheet. You will anyway not be able to avoid reading it if you are serious about programming the atmega168.

http://www.atmel.com/dyn/resourc...

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Would this be configured as part of the bootloader

Could be.

Quote:

fuses

No.

Quote:

something else

Could be.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hey, i have a different development board which has the UART pins wired to LEDs as well as MAX232.

http://thinklabs.in/shop/product...

I dont have a problem with it.
I may be possible that the bootloader is not jumping to the application sector in its default state. This is a bug in the boot loader. which is wierd coz arduino is a pretty good standard. try flashing the latest bootloader in the board.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the pointers guys. I'm a career RF and analog IC guy. I've got a product to deliver so I'm serious about learning pretty much every intricacy about the AVR MCUs and have pretty much read the whole data sheet but I haven't learned beans about boot loaders. I can work around this easy enough for now and will learn about the boot loader before I order my first hardware prototype. At least I can put this on my todo list for now and not stress over it!

Thanks again.