{"action":"opened","issue":{"url":"https://api.github.com/repos/Manouchehri/smi2021/issues/24","repository_url":"https://api.github.com/repos/Manouchehri/smi2021","labels_url":"https://api.github.com/repos/Manouchehri/smi2021/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/Manouchehri/smi2021/issues/24/comments","events_url":"https://api.github.com/repos/Manouchehri/smi2021/issues/24/events","html_url":"https://github.com/Manouchehri/smi2021/issues/24","id":132495306,"number":24,"title":"Too many broken frames on the 4 channel device","user":{"login":"mateakos1","id":12672711,"avatar_url":"https://avatars.githubusercontent.com/u/12672711?v=3","gravatar_id":"","url":"https://api.github.com/users/mateakos1","html_url":"https://github.com/mateakos1","followers_url":"https://api.github.com/users/mateakos1/followers","following_url":"https://api.github.com/users/mateakos1/following{/other_user}","gists_url":"https://api.github.com/users/mateakos1/gists{/gist_id}","starred_url":"https://api.github.com/users/mateakos1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mateakos1/subscriptions","organizations_url":"https://api.github.com/users/mateakos1/orgs","repos_url":"https://api.github.com/users/mateakos1/repos","events_url":"https://api.github.com/users/mateakos1/events{/privacy}","received_events_url":"https://api.github.com/users/mateakos1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-09T18:31:41Z","updated_at":"2016-02-09T18:31:41Z","closed_at":null,"body":"I have the 4 channel device with SAA7113H chip. I'm using my Nokia N900 as signal source, so good quality signal is generated and I get many broken frames. Tried to debug it, I have even rewritten the **parse_video** function, but can't solve the problem. I've added some code, to search for TRC and print statistics in about every half second (after every 16384 TRC) It prints the TRC value, and the length of the data block from that TRC value to the next TRC. It also prints a line, if any data length changes.\r\nSee the results, and add any suggestions:\r\n```\r\n[23742.502984] smi2021 1-1:1.0: Skip broken frame: 230 line, but need 288 in current 576 height\r\n[23742.503014] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1100\r\n[23742.504070] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1868\r\n[23742.504088] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23742.504099] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=922\r\n[23742.504111] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1044\r\n[23742.504128] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23742.506782] smi2021 1-1:1.0: Skip broken frame: 56 line, but need 288 in current 576 height\r\n[23742.509116] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1444\r\n[23742.616716] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23742.616724] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23742.616727] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23742.616729] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23742.616731] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23742.616733] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23742.616735] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23742.616737] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23742.616739] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23742.758197] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=2548\r\n[23742.758248] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1524\r\n[23742.758259] smi2021 1-1:1.0: Skip broken frame: 2 line, but need 288 in current 576 height\r\n[23742.758270] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1444\r\n[23742.758276] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=254\r\n[23742.758291] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1020\r\n[23742.758318] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1444\r\n[23742.769353] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23743.027281] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1100\r\n[23743.027308] smi2021 1-1:1.0: Skip broken frame: 286 line, but need 288 in current 576 height\r\n[23743.027352] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=1096\r\n[23743.027368] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23743.028358] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=3700\r\n[23743.028370] smi2021 1-1:1.0: Skip broken frame: 2 line, but need 288 in current 576 height\r\n[23743.028379] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=608\r\n[23743.028396] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=1444\r\n[23743.049643] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23743.141093] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23743.141103] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23743.141106] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23743.141109] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23743.141111] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23743.141114] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23743.141116] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23743.141119] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23743.141121] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23743.666505] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23743.666516] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23743.666522] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23743.666528] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23743.666533] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23743.666538] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23743.666542] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23743.666547] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23743.666552] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23744.190845] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23744.190853] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23744.190856] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23744.190859] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23744.190862] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23744.190864] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23744.190867] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23744.190870] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23744.190872] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23744.298466] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1100\r\n[23744.298487] smi2021 1-1:1.0: Skip broken frame: 129 line, but need 288 in current 576 height\r\n[23744.298519] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1100\r\n[23744.298531] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1440\r\n[23744.299598] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23744.299610] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1328\r\n[23744.299620] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1042\r\n[23744.299631] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23744.299637] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=670\r\n[23744.299649] smi2021 1-1:1.0: New different length for TRC=0x80 LEN=1444\r\n[23744.308517] smi2021 1-1:1.0: Skip broken frame: 155 line, but need 288 in current 576 height\r\n[23744.310915] smi2021 1-1:1.0: New different length for TRC=0xC0 LEN=1444\r\n[23744.508775] smi2021 1-1:1.0: New different length for TRC=0xA0 LEN=1100\r\n[23744.509843] smi2021 1-1:1.0: New different length for TRC=0xA0 LEN=1444\r\n[23744.509863] smi2021 1-1:1.0: New different length for TRC=0xA0 LEN=1524\r\n[23744.509894] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=380\r\n[23744.509905] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=1028\r\n[23744.509922] smi2021 1-1:1.0: New different length for TRC=0xE0 LEN=1444\r\n[23744.529849] smi2021 1-1:1.0: New different length for TRC=0xA0 LEN=1444\r\n[23744.715209] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23744.715219] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23744.715222] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23744.715225] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23744.715228] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23744.715231] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23744.715234] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23744.715237] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23744.715239] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23745.240603] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23745.240613] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23745.240618] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23745.240621] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23745.240624] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23745.240626] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23745.240629] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23745.240632] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23745.240635] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n[23745.764967] smi2021 1-1:1.0: TRC STATS (ntrcs=8)\r\n[23745.764976] smi2021 1-1:1.0: TRC=0x80 LEN=1444\r\n[23745.764980] smi2021 1-1:1.0: TRC=0x90 LEN=4\r\n[23745.764983] smi2021 1-1:1.0: TRC=0xB0 LEN=4\r\n[23745.764985] smi2021 1-1:1.0: TRC=0xA0 LEN=1444\r\n[23745.764988] smi2021 1-1:1.0: TRC=0xF0 LEN=4\r\n[23745.764990] smi2021 1-1:1.0: TRC=0xE0 LEN=1444\r\n[23745.764993] smi2021 1-1:1.0: TRC=0xD0 LEN=4\r\n[23745.764995] smi2021 1-1:1.0: TRC=0xC0 LEN=1444\r\n```\r\nThe statistics code is like this:\r\n```C\r\nfor (i=0;i<size;i++) {\r\n\t\tlen++;\r\n\t\tpattern=(pattern<<8)|p[i];\r\n\t\tif ((pattern&0xffffff00)==0xff000000) {\r\n\t\t\tu8 trc;\r\n\t\t\ttrc = pattern&0xf0;\r\n\t\t\tif (lens[previndex]!=len) {\r\n\t\t\t\tdev_info(smi2021->dev,\"New different length for TRC=0x%02X LEN=%d\",(int)trcs[previndex],len);\r\n\t\t\t}\r\n\t\t\tlens[previndex] = len;\r\n\t\t\tlen = 0;\r\n\t\t\tfor (j=0;j<ntrcs;j++)\r\n\t\t\t\tif (trcs[j]==trc)\r\n\t\t\t\t    break;\r\n\t\t\tif (j==ntrcs) {\r\n\t\t\t\t/*not found*/\r\n\t\t\t\tif (ntrcs<16) {\r\n\t\t\t\t\t/*create new entry*/\r\n\t\t\t\t\tntrcs++;\r\n\t\t\t\t\ttrcs[j]=trc;\r\n\t\t\t\t\tlens[j]=0;\r\n\t\t\t\t\tprevindex=j;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t/*found*/\r\n\t\t\t\tprevindex=j;\r\n\t\t\t}\r\n\t\t\tlines++;\r\n\t\t\tif ((lines&0x3fff)==0) {\r\n\t\t\t\t/*print stats*/\r\n\t\t\t\tdev_info(smi2021->dev,\"TRC STATS (ntrcs=%d)\",ntrcs);\r\n\t\t\t\tfor (j=0;j<ntrcs;j++) {\r\n\t\t\t\t\tdev_info(smi2021->dev,\"TRC=0x%02X LEN=%d\",(int)trcs[j],lens[j]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n```\r\nIf you add the number of lines in two consecutive broken frames, most of the times, the sum is around the required number of lines."}}