OK, deep breath... :)
exxos wrote: 21 Jun 2023 20:31
Only just got home and turned on the booster is to have some weird reset issues now :shrug: I assume it only happens when the machine is "cold"
@Badwolf There is some notes in your code mentioning problems with EMUTOS starting up ?
Disabling the flash seems to alleviate the problem..
Here's what I think is happening, why that resetblock is wrong and what EmuTOS has to do with it.
The Falcon boots up in 8MHz mode. At a short time later the OS switches it to 16MHz mode.
On my earlier boards I could happily clock switch 50MHz to both 16 and 8MHz modes and I didn't realise that this had changed. It turns out, for whatever reason, my current board design or clockswitch logic cannot cope with a 50 to 8MHz switch.
(The switching works by holding one half cycle for up to two 'slow' cycles. So at 16MHz there's an 8MHz half cycle injected before 50MHz goes down to 16MHz. That's fine and normally transparent as all my 'slow' accesses take more than two cycles anyway. But at 8MHz, there's a 4MHz half-cycle in there.
THEORY: It's possible that's too slow for some chips as the 030 has a dynamic core and hence a minimum clock frequency which is, roughly, around that figure)
So, long story short, if you toggle the system clock to 8MHz using a CPX or a poke to the bus control register, DFB1 hangs. This is non-ideal, but who the hell does that anyway? Just disable the DFB1 i f you want 8MHz mode.
THEORY: Normally at bootup, the 030 is reading from system ROM and using ST RAM both at system board speeds. There's no reason to speed up to 50MHz until the switch to a 16MHz motherboard has happened. So you kind of get away with it.
THEORY CONTINUED: I put EmuTOS on my flash ROM. I start seeing reset problems. I mistakenly identify it as an EmuTOS difference (cf. the comment in code) and discover that adding a timer delay after reset before allowing acceleration works. I just go with it as I have space.
THEORY CONTINUED: In retrospect it seems more likley it's this 8/50 swtiching issue and when executing code from Flash, the system is performing this switch immediately, before the OS has changed to 16MHz.
PROPOSAL: change the (arbitrary) timer to instead veto acceleration on reset and only clear after the first access to the bus control register, assuming it's the OS's speed-up call. This should have the advantage of saving macrocells to boot.
LONG-TERM FIX: come up with better clock switching logic. I'm sure it's doable, but I've not really thrown more than a few hours at it so far.
BW