Skip to content

How to reset a peripheral RP2040(SPI1) #1169

@DmitriLyalikov

Description

@DmitriLyalikov

I am working on extending the spi implementation to include a slave configuration for the RP2040 hal.
This does require a resetting of the peripheral and I am not sure how to interact with these functions below:

Please elaborate on usage and the meaninf of the Peripherals struct. Is this the correct way to do a reset like:
reset(&mut p.SPI1);

In embassy_rp/src/reset.rs:
These functions are provided:
pub unsafe fn reset(peris: Peripherals) {
pac::RESETS.reset().write_value(peris);
}

pub unsafe fn unreset_wait(peris: Peripherals) {
// TODO use the "atomic clear" register version
pac::RESETS.reset().modify(|v| *v = Peripherals(v.0 & !peris.0));
while ((!pac::RESETS.reset_done().read().0) & peris.0) != 0 {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions