Go Down

Topic: Do Not Use SPI Pins with LCD... Mega 2560 (Read 10571 times) previous topic - next topic


Jan 23, 2011, 07:36 pm Last Edit: Jan 24, 2011, 02:09 am by fillibar Reason: 1
Running into an apparent conflict between the LiquidCrystal library and the Ethernet and UDP libraries. I get invalid characters and such on the LCD. Unfortunately this is entirely expected and completely my fault. So if anyone else hits this, follow the reply below. DO NOT USE pins 50, 51, or 52 except for SPI and do not use pin 53 if you are using the Ethershield.


Why is is that everyone wants to use the SPI pins to connect their LCDs to?

Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work.

Code: [Select]
LiquidCrystal lcd( 48, 49,[glow] 50, 51, 52, 53[/glow] );
The art of getting good answers lies in asking good questions.


Jan 24, 2011, 02:04 am Last Edit: Jan 24, 2011, 02:10 am by fillibar Reason: 1
Sorry about that. I think everyone does it (and misses that point) because there is no physical connection to those pins (apparently, since it uses the ICSP header). When the Ethershield is covering the other pins it makes sense that some would be used. On a related note, all the tutorials mention ports 11-13 but nothing about the differences for the Mega. Ignorance is not an excuse though... and the tutorials have to be written with SOME basis of understanding.

Thanks again for the information. That of course solved it.


because there is no physical connection to those pins

No physical connection between what and the SPI pins? The Ethernet shield makes a physical connection to the SPI pins (although it is to the Duemilanove SPI pins which need to be jumpered to the Mega SPI pins.

apparently, since it uses the ICSP header

What does?
The art of getting good answers lies in asking good questions.


Jan 24, 2011, 04:09 am Last Edit: Jan 24, 2011, 04:12 am by fillibar Reason: 1
The Mega 2560 has SPI on pins 50, 51, and 52. The Ethershield only physically covers pins 0-13, A0 - A5, AREF, 3 GNDs, 5V, 3.3V, and RESET. Pins 14-53, 2 GNDs, 2 5V, and A6-A15 are exposed. I combined the Ethershield and Mega 2560 images to show this.

The 4th paragraph (line 1) of the Ethershield page indicates that it uses the SPI bus through the ICSP header. This would also explain why the Ethershield does not pass the ICSP header through. It is using it.

As for jumpering the pins that does not appear to be necessary. I have not seen any reference to that yet and the Ethershield is working fine at this time.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131