Author Topic: Almost no pins seem to work, is this a bad part?  (Read 1651 times)

kris

  • NewMember
  • *
  • Posts: 2
Almost no pins seem to work, is this a bad part?
« on: October 15, 2018, 10:28:03 PM »
I was able to program a moteino using a pocket AVR programmer from sparkfun and the Arduino IDE. I was able to get a simple 'blink' program to run on it using the onboard LED. However, no other pins seem to work except the 'MOSI' pin when I tried testing them. Making the board essentially useless.Here's the test code I ran:
Code: [Select]
void setup() {
  pinMode(9, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  digitalWrite(9, HIGH);
  digitalWrite(1, HIGH);
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH);
  delay(1000);                       // wait for a second
  digitalWrite(9, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  delay(1000);                       // wait for a second
}
Again, only pin 9 (the LED) and MOSI work. Please help me out.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Almost no pins seem to work, is this a bad part?
« Reply #1 on: October 16, 2018, 10:37:27 AM »
If it's a Moteino board with radio and flash memory then you will have conflicts on pins 2, 8, 10, and 11.   If you are testing pins, do each individually.  As you found, pin 9 is easy.  The rest I'd say configure all to INPUT_PULLUP and then test each one with an output pulse sequence, resetting it back to INPUT_PULLUP after the test.  I'm not sure that 2 can be tested this way as it depends on how the radio is configured.

Also, if you do have a radio and flash memory, then you should have pullup resistors on pins 8 (Flash SS) & 10 (Radio SS) when programming via ISP interface.

Tom

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Almost no pins seem to work, is this a bad part?
« Reply #2 on: October 16, 2018, 11:24:23 AM »
Also, if you do have a radio and flash memory, then you should have pullup resistors on pins 8 (Flash SS) & 10 (Radio SS) when programming via ISP interface.
I think only the radio SS# pullup would be needed as the flash DO is not actually enabled unless it detects a valid read command, unlike the radio which will turn its output on directly with its SS#.

Mark.

LukaQ

  • Sr. Member
  • ****
  • Posts: 302
  • Country: si
Re: Almost no pins seem to work, is this a bad part?
« Reply #3 on: October 16, 2018, 11:31:24 AM »
I have similar test, but I don't test it with flash or radio, so try to exclude all those pins from use

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Almost no pins seem to work, is this a bad part?
« Reply #4 on: October 16, 2018, 01:55:15 PM »
I think only the radio SS# pullup would be needed as the flash DO is not actually enabled unless it detects a valid read command, unlike the radio which will turn its output on directly with its SS#.

Mark.
But if you're programming via ISP, how do you guarantee that there isn't a valid read command in the sequence?  I've always used a pullup on all SPI device CS pins when I'm using the ISP programmer.  It's easy insurance that can be mounted on the programmer.

Tom

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Almost no pins seem to work, is this a bad part?
« Reply #5 on: October 16, 2018, 03:30:32 PM »
But if you're programming via ISP, how do you guarantee that there isn't a valid read command in the sequence?  I've always used a pullup on all SPI device CS pins when I'm using the ISP programmer.  It's easy insurance that can be mounted on the programmer.
Yes, I forgot all these signals are on the connector. I know Felix has had success with only the radio SS# pulled high.

I suspect it works without a pull-up because the flash SS# tends to float low or high permanently (but that's not guaranteed). If it's permanently high there's no issue, if permanently low the first 8 bits get shifted into the command register, at that point it's decoded and the output turned on if a read. As there's an 8 bit counter it's possible after the first 8 bits no more decoding is done without a new transition on SS# irrespective of more SCKs, so if the first 8 bits of a programming sequence don't match a command all's well for the rest of the sequence.

But yes, you're right, pull up the flash SS# too to be sure.

Mark.