atsams-rs / atsamx7x-rust

Rust HAL, PACs, and examples for the Microship SAM E70/S70/V70/V71
Apache License 2.0
24 stars 11 forks source link

USART/USART mode: Missing mode setup #27

Closed tmplt closed 1 year ago

tmplt commented 1 year ago

Copied from internal issue tracker:

USART setup is not done properly if the first mode to be entered is the "normal" mode. When first entering the USART mode, the requested mode is compared against the reset mode, which is the normal USART mode. Therefore, in enter_mode, the check

    if self.mode() == H::MODE {
        // Already in the requested mode
        return;
    }

returns early and leaves my USART uninitialized unless I've switched to some other mode before. My suggestion would simply be to remove this check, unless there's some really good reason why we wouldn't want to let the user soft-reset the peripheral by switching to the same mode.

tmplt commented 1 year ago

CC @axel-grepit