Closed LeonardMH closed 5 years ago
I'm curious if this is just me misunderstanding how the precision internal oscillator is configured, or something more fundamental. Is there any chance you could you retry with:
let mut sc = p.SYSCTL.constrain();
sc.clock_setup.oscillator = sysctl::Oscillator::Main(
sysctl::CrystalFrequency::_16mhz,
sysctl::SystemClock::UsePll(sysctl::PllOutputFrequency::_80_00mhz),
);
let clocks = sc.clock_setup.freeze();
I know this configuration is good as I can generate valid VGA signals at 20MHz on a divide by 4 on the SPI. If your delays are still wrong with this setup, it's the Delay
code. If your delays look good, it's probably the oscillator configuration or clock calculations.
From the port to the tm4c129x, I think https://github.com/thejpster/tm4c123x-hal/blob/4e38c58addebe599c0d32b20af844d5cd0c8b720/src/sysctl.rs#L828 https://github.com/thejpster/tm4c123x-hal/blob/4e38c58addebe599c0d32b20af844d5cd0c8b720/src/sysctl.rs#L856 https://github.com/thejpster/tm4c123x-hal/blob/4e38c58addebe599c0d32b20af844d5cd0c8b720/src/sysctl.rs#L881 and https://github.com/thejpster/tm4c123x-hal/blob/4e38c58addebe599c0d32b20af844d5cd0c8b720/src/sysctl.rs#L898 should be w.sysdiv().bits((div as u16 - 1) as u8);
or similar.
A divider of /1 should be achieved by writing 0 into the sysdiv register, therefore I believe that the 1 that this code is writing gets treated as /2.
Environment
See https://github.com/thejpster/tm4c123x-hal/issues/12#issue-377004594. Otherwise my main.rs is all that has changed:
When I run this I see: