Commit e51158b
[nrf fromtree] samples: usb: uac2: explicit: Fix SOF offset integer conversion glitch
Rework the formula used to convert timer CC values to SOF offset to
eliminate a "division glitch" happening around SOF crossing, i.e. when
the framestart shifts from being captured shortly before SOF to being
captured shortly after SOF.
When audio samples are consumed faster than nominal, i.e. when there
is +1 samples every now and then, the reported SOF offset at High-Speed
was going 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, "glitch" 7, 6, 5, 4, 3, 2,
1, 0, -1, -2, ...
With the fix the SOF offset goes as expected from 0 to -1, i.e. there is
no jump from 0 to 7 around the SOF crossing and the reported SOF offset
goes linearly (until it is correclty bumped from negative values back to
positive values when +1 sample packet is transmitted on I2S).
Signed-off-by: Tomasz Moń <[email protected]>
(cherry picked from commit 6bb4cb5)1 parent 0cdba8b commit e51158b
1 file changed
+7
-8
lines changedLines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
286 | | - | |
287 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 294 | + | |
| 295 | + | |
297 | 296 | | |
298 | 297 | | |
299 | 298 | | |
| |||
0 commit comments