{"action":"created","issue":{"url":"https://api.github.com/repos/ArduCAM/Arduino/issues/72","repository_url":"https://api.github.com/repos/ArduCAM/Arduino","labels_url":"https://api.github.com/repos/ArduCAM/Arduino/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/ArduCAM/Arduino/issues/72/comments","events_url":"https://api.github.com/repos/ArduCAM/Arduino/issues/72/events","html_url":"https://github.com/ArduCAM/Arduino/issues/72","id":170368004,"number":72,"title":"Arducam Rev C+ shield runs out of fifo","user":{"login":"aldobranti","id":9655839,"avatar_url":"https://avatars.githubusercontent.com/u/9655839?v=3","gravatar_id":"","url":"https://api.github.com/users/aldobranti","html_url":"https://github.com/aldobranti","followers_url":"https://api.github.com/users/aldobranti/followers","following_url":"https://api.github.com/users/aldobranti/following{/other_user}","gists_url":"https://api.github.com/users/aldobranti/gists{/gist_id}","starred_url":"https://api.github.com/users/aldobranti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldobranti/subscriptions","organizations_url":"https://api.github.com/users/aldobranti/orgs","repos_url":"https://api.github.com/users/aldobranti/repos","events_url":"https://api.github.com/users/aldobranti/events{/privacy}","received_events_url":"https://api.github.com/users/aldobranti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2016-08-10T09:07:01Z","updated_at":"2016-08-17T00:33:58Z","closed_at":null,"body":"I have a rev C shield attached to a mega 2560 and an ov5642 5mp. The setup executes the demonstration program Arducam_OV5642_Digital_Camera and captures a 5MP image to SD card _most of the time_. Occasionally it produces a truncated and corrupt JPEG.\r\n\r\nMy own code uses the same fifo reading loop as the demonstration (+print statements)\r\n`i = 0;\r\n  temp = myCAM.read_fifo();\r\n  //Write first image data to buffer\r\n  buf[i++] = temp;\r\n  \r\n  //Read JPEG data from FIFO\r\n  while ( (temp != 0xD9) | (temp_last != 0xFF) )\r\n  {\r\n    temp_last = temp;\r\n    temp = myCAM.read_fifo();\r\n    //Write image data to buffer if not full\r\n    if (i < 256)\r\n      buf[i++] = temp;\r\n    else {\r\n      //Write 256 bytes image data to file\r\n      Serial.print(\"*\");\r\n      outFile.write(buf, 256);\r\n      i = 0;\r\n      buf[i++] = temp;\r\n    }\r\n  }\r\n  Serial.print(\"finished (?) temp=0x\");Serial.print(temp,HEX);Serial.print(\" temp_last=0x\");Serial.println(temp_last,HEX);\r\n`\r\n\r\nI get a * for each 256b block ( between 1k and 11k bytes written to SD and the exit conditions show temp == 0xD9 & temp_last == 0xFF\r\n\r\nSide question : what do 0xD9 and 0xFF encode\r\n\r\nI was thinking that I needed to allow the fifo to settle down even after a check of\r\n`myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK)`, delaying 1s does not change anything; regrettably read_fifo_length is not supported on the REV C, \r\n\r\nattached is a captured, but corrupt jpeg\r\n\r\n![00000025](https://cloud.githubusercontent.com/assets/9655839/17548057/07a52e88-5ee2-11e6-951f-89ed57190579.JPG)\r\n\r\n\r\ncan you suggest anything ?\r\n"},"comment":{"url":"https://api.github.com/repos/ArduCAM/Arduino/issues/comments/240281082","html_url":"https://github.com/ArduCAM/Arduino/issues/72#issuecomment-240281082","issue_url":"https://api.github.com/repos/ArduCAM/Arduino/issues/72","id":240281082,"user":{"login":"ArduCAM","id":11016968,"avatar_url":"https://avatars.githubusercontent.com/u/11016968?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduCAM","html_url":"https://github.com/ArduCAM","followers_url":"https://api.github.com/users/ArduCAM/followers","following_url":"https://api.github.com/users/ArduCAM/following{/other_user}","gists_url":"https://api.github.com/users/ArduCAM/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduCAM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduCAM/subscriptions","organizations_url":"https://api.github.com/users/ArduCAM/orgs","repos_url":"https://api.github.com/users/ArduCAM/repos","events_url":"https://api.github.com/users/ArduCAM/events{/privacy}","received_events_url":"https://api.github.com/users/ArduCAM/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T00:33:58Z","updated_at":"2016-08-17T00:33:58Z","body":"@aldobranti, I'm not sure if you can run 921600bps on your Mac, there should be \"ArduCAM Start!\" \"OV5642 detected.\" when you open the COM port.\r\nWould you please try to change the baudrate to 115200bps in example sketch and try it again?\r\n\r\n"}}
{"actor":{"display_login":"ArduCAM"}}