thejpster / monotron

A simple 8-bit home computer style application for the TI Tiva-C Launchpad
Apache License 2.0
191 stars 9 forks source link

Video jitter #26

Closed thejpster closed 5 years ago

thejpster commented 6 years ago

I think I've worked out why there's visible jitter on the video - I think it's variable interrupt latency. From what I've read, it seems the interrupt latency can be affected by whatever code you happen to be running when the interrupt occurs. This is further exacerbated by the fact that at 80 MHz we must run the flash at 40 MHz and endure wait states. Some random thoughts follow:

let jumps = [ one_nop, two_nops, three_nops, four_nops ]
let t = read_timer();
function = jumps[t & 0x03];
function();
thejpster commented 5 years ago

Or we can set another timer isr which just nops a lot, at a priority just one lower. The jump into the start routine is then always from this isr.

thejpster commented 5 years ago

We could also put the routine in RAM.

thejpster commented 5 years ago

Or we can set another timer isr which just nops a lot, at a priority just one lower. The jump into the start routine is then always from this isr.

I fixed this in this way, but with a wfi instead of a nop. Putting routines in RAM helped, as did moving the vector table, but with this fix it runs fine with them in a flash, so I put them back.

See 4d1a9b7