Start a new topic

Iteaduino Mega Digital Pin outs

Hi All,


I am having issues with my Iteaduino Mega 2560 - I can't program most of the "D" pins for digital out.


I have a simple LED connected between ground and the D pin and the pin never seems to go high.


I have even attached my volt meter to this and I see the pin sitting around 0.6v, never higher.


Am I missing something here ?!


Cheers,


Pieter


Hi,


I "solved" this issue - it turns out that the documentation on this link:


http://wiki.iteadstudio.com/Iteaduino_MEGA_2560


is wrong.


D7 is meant to be PH4 according to the way I read that page, but in reality, it's PH7. The schematic is also wrong, taken from here:


ftp://imall.iteadstudio.com/IM120410003_Iteaduino_MEGA_2560/Documents/SCH_IM120410003_Iteaduino_MEGA_2560.pdf


This also shows PH4 as the connection.... ITEAD - come on - fix your documentation - this has set me back hours !!!

Hi


D7 is PH4, you can read the pinmap from the arduino website.


http://www.arduino.cc/en/Hacking/PinMapping2560



Hi Stan,


Can you take one of your Iteadiuno Mega's and try "blinking" that pin using PH4 ? on mine, I had to use PH7


Cheers,


Pieter

Hi,


This is the board I tried it on:


https://www.itead.cc/iteaduino-mega-2560.html


Cheers,


Pieter

Hi


Yes, I tried it, there is no problem when i use D7. I can light up a LED.


Regards,

Stan Lee

wow - ok - there must be something wrong with my board then :(

Right - I got to the bottom of this issue, at least for my setup. I had to use yet another two pins for SS and INT and came across my original issue, yet again. I then wrote a simple blinking sketch and in the setup () function, I "printed" the value of PH7. 


I my setup, all of the P*7 const, contain a value of 7, so, PA7==PB7==PC7==PD7==7


This may be due to a missing header file or something, but I "fixed" this issue by addressing the pins using numbers, rather than predefined const.


For the record, my findings are D24==24 D23==23 and so on. This is why my PH7 worked on D7.


I *still* don't understand how Stan got the PIN on D7 to blink, using PH4 - that is beyond me.


Perhaps this can be of use to someone else running into this issue. If you are not affected by this issue, then all the better for you and happy coding !

Hi,


According to the pinmap of atmega 2560, D7 is the PH4. It works on every atmega 2560 board that we made. 


http://www.arduino.cc/en/Hacking/PinMapping2560





Didn't you use the arduino mega bootloader in your code?




Hi Stan,


Not sure on the bootloader - this is a normal install of the IDE. The board is used as it is shipped from your factory. I can post a video of my findings if that will help ?


Also, the mapping I am talking about is in the header files - can I ask you to see what the value of PH4 is ? Can you compare that to the value of PH7, PA7 and PB7 ?


Thanks,


Pieter

You can read the pinmap on that link.


http://www.arduino.cc/en/Hacking/PinMapping2560


PH4->D7

PH7->NOT DEFINED

PA7->D29

PB7->D13

Hi,


Yip, I see that, but that doesn't show what it maps to in the code. Following that page, you should be able to address D7 as 16 while testing on my mega, it was 7.


I did a simple:


Serial.println (String (PH7));


to get the value.


Cheers,


Pieter

Your code doesn't prove anything, it says PH7 is the pin 7 of PH line. If you use Serial.println (String (PH0)); it will output 0.


So what is your point? I don't understand what you want to do.


D7 is PH4, so when you use the following code, it can output a 0.5Hz signal on PH4.


void setup() {

  // initialize digital pin 7(PH4) as an output.

  pinMode(7, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

  digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)

  delay(1000); // wait for a second

  digitalWrite(7, LOW); // turn the LED off by making the voltage LOW

  delay(1000); // wait for a second

}



Arduino has remapped the pinmap of the GPIOs.

Stan,


I am trying to prove that, even thou your documentation says that I should be able to access D7 on PH4, I can't.


Perhaps I misunderstand why these #define's are done, but in my mind, it's to make it easier for people to address the correct PINs. I should be able to do the following:


pinMode (D7,OUTPUT); // This fails since D7 isn't defined

or

pinMode (PH4,OUTPUT); // This compiles, but the result is wrong (on my board this is pin D4)


The reason for this is to avoid someone having to look into the schematic to find that D7 is mapped to pin 7 of the chip, which will work as follow:


pinMode (7,OUTPUT);


Your code almost shows my issue - you insist that D7==PH4, but you address it as 7. So, if you do a Serial.println (String (PH4)); is your output 7 ?


As for my code not proving anything, then how do you address line 7 of PA ? If you say 7, then you understand my issue, because 7 of PA is not the same as 7 of PH.


Cheers,


Pieter

The result of Serial.println (String (PH7)) is the same as Serial.println (String (PA7)). It is 7.


Offical Arduino defined all the pinmap, not us.


If you look at the schematic of arduino mega, it's the same.


http://www.arduino.cc/en/uploads/Main/arduino-mega2560_R3-sch.pdf



You can't just put PH4 into pinMode(), you should read the defination of pinMode function.

pinMode (PH4,OUTPUT) is the same as pinMode (4,OUTPUT) to set the D4(PG5) pin to output.






Login or Signup to post a comment