{"action":"closed","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/4518","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/4518/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/4518/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/4518/events","html_url":"https://github.com/esp8266/Arduino/issues/4518","id":305355032,"number":4518,"title":"SD Card reader (SPI) and LCD display (I2C) not working together","user":{"login":"avdbrink","id":5593081,"avatar_url":"https://avatars0.githubusercontent.com/u/5593081?v=4","gravatar_id":"","url":"https://api.github.com/users/avdbrink","html_url":"https://github.com/avdbrink","followers_url":"https://api.github.com/users/avdbrink/followers","following_url":"https://api.github.com/users/avdbrink/following{/other_user}","gists_url":"https://api.github.com/users/avdbrink/gists{/gist_id}","starred_url":"https://api.github.com/users/avdbrink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avdbrink/subscriptions","organizations_url":"https://api.github.com/users/avdbrink/orgs","repos_url":"https://api.github.com/users/avdbrink/repos","events_url":"https://api.github.com/users/avdbrink/events{/privacy}","received_events_url":"https://api.github.com/users/avdbrink/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-14T22:43:03Z","updated_at":"2018-03-16T00:18:12Z","closed_at":"2018-03-16T00:18:12Z","author_association":"NONE","body":"### Basic Infos\r\n\r\n- [x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).\r\n- [x] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.\r\n- [ ] I have tested that the issue is present in current master branch (aka latest git).\r\n- [x] I have searched the issue tracker for a similar issue.\r\n- [x] If there is a stack dump, I have decoded it.\r\n- [x] I have filled out all fields below.\r\n\r\n#### Platform\r\n\r\n- Hardware:\t\t\t\t\tWemos D1 R2 / ESP8266\r\n- Core Version:\t\t\t2.4.1\r\n- Development Env:\t\tArduino IDE\r\n- Operating System:\t\tMacOS\r\n\r\n### Settings in IDE\r\n\r\n- Module:  \t\t\tWemos D1 R2 & mini\r\n- Flash Size: \t\t4MB\r\n- lwip Variant:   v2 Lower Memory\r\n- CPU Frequency:\t\t80Mhz\r\n- Upload Using:\t\tSERIAL\r\n- Upload Speed:   921600\r\n\r\n\r\n### Problem Description\r\n\r\nCombining an SD card reader on SPI and an LCD display on I2C connected to a Wemos D1 R2 with ESP8266 does not seem to be working. \r\nBoth the SD card reader and the LCD display work correctly if used separate, that is: both are connected, but only one is activated in code. But once I combine both of the devices in one sketch, the display stops working after the SD card has been initialised.\r\n\r\nPin connections used is D1 & D2 for I2C and D5, D6, D7 & D8 for SPI.\r\n\r\nI've tested the same setup with a regular Arduino Uno and that works. So I assume it has something to do with the ESP8266 library.\r\n\r\nUsed the most recent 2.4.1 hardware library and even tried some earlier version. \r\n\r\nMinimal code looks like this:\r\n```cpp\r\n\r\n// include the SD library:\r\n#include <SPI.h>\r\n#include <SD.h>\r\n\r\n// include the wire and LCD I2C libraries:\r\n#include <Wire.h> \r\n#include <LiquidCrystal_I2C.h>\r\n\r\nconst int chipSelect = 4;\r\n\r\n// set up variables using the SD utility library functions:\r\nSd2Card card;\r\n\r\n// Set the LCD address to 0x27 for a 16 chars and 2 line display\r\nLiquidCrystal_I2C lcd(0x27, 20, 4);\r\n\r\nvoid setup()\r\n{\r\n  // Open serial communications and wait for port to open:\r\n  Serial.begin(115200);\r\n  while (!Serial) {\r\n    ; // wait for serial port to connect. Needed for Leonardo only\r\n  }\r\n\r\n  // initialize the LCD\r\n  lcd.begin();\r\n  lcd.clear();\r\n  delay(2000);\r\n  // Turn on the blacklight and print a message.\r\n  lcd.backlight();\r\n  lcd.print(\"Hello, world!\");\r\n\r\n  Serial.print(\"\\nInitializing SD card...\");\r\n\r\n  // we'll use the initialization code from the utility libraries\r\n  // since we're just testing if the card is working!\r\n  if (!card.init(SPI_HALF_SPEED, chipSelect)) {\r\n    Serial.println(\"initialization failed.\");\r\n    return;\r\n  } else {\r\n    Serial.println(\"Wiring is correct and a card is present.\");\r\n  }\r\n\r\n  lcd.setCursor(0,3);\r\n  lcd.print(\"Hello to you too!\");\r\n  \r\n  Serial.println(\"Finished setup()\");\r\n}\r\n\r\n\r\nvoid loop(void) {\r\n\r\n}\r\n```\r\n\r\nI see the last Serial.println in the serial monitor, but the display never shows \"Hello to you too!\", only \"Hello, world!\".\r\n\r\n\r\n"}}
{"actor":{"display_login":"devyte"}}