neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
948 stars 191 forks source link

Mega with SD card and ST7920 LCD display #360

Closed hicksan closed 3 years ago

hicksan commented 3 years ago

I am trying to set up a Mega with an SD card and an ST7920 164x48 display. Both are using the SPI bus with pins 50-52. I have set the CS for the LCD as 53 and the CS for the SD card as pin 9. The problem I face is I can't get either to work if both are connected, even with the basic example programs as supplied by the libraries.

However the SDCard library shows problems even without the LCD connected, as the only item attached to the Mega.

The SDCard.INO program outputs: Main menu

];,'"\ Something else,,, <Back

It then just repeats the initialization. I get similar garbage with either Mega or UNO.

The SD card reader works fine with the Arduino SD library.

Any suggestions anyone?

hicksan commented 3 years ago

I am now testing with just the SD Card Reader and an Uno, but getting the same error. I have tried this with the SDFat plugin as well, with the same results. When I use the base SD or SDFat libraries the card reader works fine. I have tried several of their example files without problem. It is only the ArduinoMenu examples that fail. I am only using the example files and changing only to add the following:

define SDCARD_SS 9

and set serial speed to 115200.

hicksan commented 3 years ago

Solved by moving the ST7920 onto a different (software) SPI bus with different pins. The card reader and screen were clashing for control of the bus.