{"action":"created","issue":{"url":"https://api.github.com/repos/adafruit/SD/issues/7","repository_url":"https://api.github.com/repos/adafruit/SD","labels_url":"https://api.github.com/repos/adafruit/SD/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/adafruit/SD/issues/7/comments","events_url":"https://api.github.com/repos/adafruit/SD/issues/7/events","html_url":"https://github.com/adafruit/SD/issues/7","id":13903104,"number":7,"title":"SD.Begin(int, int. int. int) can only be called once.","user":{"login":"davidstellini","id":4324419,"avatar_url":"https://avatars.githubusercontent.com/u/4324419?v=3","gravatar_id":"","url":"https://api.github.com/users/davidstellini","html_url":"https://github.com/davidstellini","followers_url":"https://api.github.com/users/davidstellini/followers","following_url":"https://api.github.com/users/davidstellini/following{/other_user}","gists_url":"https://api.github.com/users/davidstellini/gists{/gist_id}","starred_url":"https://api.github.com/users/davidstellini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidstellini/subscriptions","organizations_url":"https://api.github.com/users/davidstellini/orgs","repos_url":"https://api.github.com/users/davidstellini/repos","events_url":"https://api.github.com/users/davidstellini/events{/privacy}","received_events_url":"https://api.github.com/users/davidstellini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2013-05-02T18:05:13Z","updated_at":"2016-06-19T19:13:08Z","closed_at":null,"body":"Demo code:\r\n\r\n#include <SD.h>\r\n\r\nvoid setup()\r\n{\r\n  Serial.begin(115200);\r\n  Serial.println(\"Starting...\");\r\n if (!SD.begin(53,2,4,3)) {  // chipSel, mosi, miso, sck\r\n    Serial.println(F(\"initialization failed!\"));\r\n  } else {\r\n    Serial.println(F(\"initialization done.\"));\r\n  }\r\n  \r\n   if (!SD.begin(53,2,4,3)) {  // chipSel, mosi, miso, sck\r\n    Serial.println(F(\"initialization failed!\"));\r\n  } else {\r\n    Serial.println(F(\"initialization done.\"));\r\n  }\r\n}\r\n\r\n\r\nvoid loop(void) {\r\n  \r\n}\r\n\r\nOutput:\r\n\r\nStarting...\r\ninitialization done.\r\ninitialization failed!\r\n\r\nExpected output:\r\nStarting...\r\ninitialization done.\r\ninitialization done."},"comment":{"url":"https://api.github.com/repos/adafruit/SD/issues/comments/227014873","html_url":"https://github.com/adafruit/SD/issues/7#issuecomment-227014873","issue_url":"https://api.github.com/repos/adafruit/SD/issues/7","id":227014873,"user":{"login":"dariosalvi78","id":5367037,"avatar_url":"https://avatars.githubusercontent.com/u/5367037?v=3","gravatar_id":"","url":"https://api.github.com/users/dariosalvi78","html_url":"https://github.com/dariosalvi78","followers_url":"https://api.github.com/users/dariosalvi78/followers","following_url":"https://api.github.com/users/dariosalvi78/following{/other_user}","gists_url":"https://api.github.com/users/dariosalvi78/gists{/gist_id}","starred_url":"https://api.github.com/users/dariosalvi78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dariosalvi78/subscriptions","organizations_url":"https://api.github.com/users/dariosalvi78/orgs","repos_url":"https://api.github.com/users/dariosalvi78/repos","events_url":"https://api.github.com/users/dariosalvi78/events{/privacy}","received_events_url":"https://api.github.com/users/dariosalvi78/received_events","type":"User","site_admin":false},"created_at":"2016-06-19T19:13:08Z","updated_at":"2016-06-19T19:13:08Z","body":"Hi,\r\n\r\nthis is definitely a bug, in fact, if you have more than one SPI device you must call begin() each time you need to switch from another device to the SD card.\r\nI have had the problem myself.\r\n\r\nSolution:\r\nin the file named SD.cpp, in function begin() (line 337) add this instruction before the return statement:\r\n`if(root.isOpen()) root.close();`\r\n\r\nthis has solved the problem for me."}}
{"actor":{"display_login":"dariosalvi78"}}