bl602-rust-guide icon indicating copy to clipboard operation
bl602-rust-guide copied to clipboard

Update examples to initialize sys_clk/uart_clk using clock::Strict

Open 9names opened this issue 4 years ago • 2 comments

This is bringing in the minimum amount of changes require for main and examples to work with the new clock code in the HAL. The UART example needed a few more modifications than the others, since it was using GLB registers to configure UART clk_en and clk_div

9names avatar Jan 05 '21 03:01 9names

I don't think it's great practice to use use some::path::*; outside of the prelude module.

I'd rather have this:

use bl602_hal::clock::{self, SysclkFreq, UART_PLL_FREQ};
use bl602_hal::{pac, prelude::*};

and later:

let clocks = clock::Strict::new() …

~Also, when running the bl602-serial example I'm no longer getting an output on the TX0 pin.~ Something's up with my setup, now I'm not even able to get it to output data with an older revision.

...

Ok, I've confirmed that it's only this change that breaks the output. I couldn't get output on older revisions before because I had to reset the device for the old code to work again.

mkroman avatar Jan 08 '21 04:01 mkroman

I've cleaned up the imports as per your suggestion, looks much better. Any further blockers on getting this merged?

9names avatar Jan 12 '21 02:01 9names