Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement UART support for ESP32-P4 #1150

Closed
wants to merge 2 commits into from

Conversation

jessebraham
Copy link
Member

Did some basic testing, seems to work as expected. Didn't include it in this PR but also tested with a modified version of the advanced_serial.rs example, tested multiple UART peripherals.

(In general, probably won't add a lot of examples for the P4 right now, since I'm also slowly working on unifying things in parallel and they'll all just be removed soon anyway...)

@bjoernQ
Copy link
Contributor

bjoernQ commented Feb 8, 2024

Code looks good to me but running hello_world in release mode gives this




!! A panic occured in 'C:\projects\review\jesse\esp-hal\esp-hal\src\lib.rs', at line 218, column 36

PanicInfo {
    payload: Any { .. },
    message: Some(
        called `Option::unwrap()` on a `None` value,
    ),
    location: Location {
        file: "C:\\projects\\review\\jesse\\esp-hal\\esp-hal\\src\\lib.rs",
        line: 218,
        col: 36,
    },
    can_unwind: true,
    force_no_backtrace: false,
}

Backtrace:

0x40005c14
0x40005c14 - core::option::unwrap_failed
    at C:\Users\Bjoern\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:1978
0x40003648
0x40003648 - esp_hal::interrupt::riscv::vectored::init_vectoring
    at ??:??
0x400000f2
0x400000f2 - _start_rust
    at C:\projects\review\jesse\esp-hal\esp-riscv-rt\src\lib.rs:68

in debug




!! A panic occured in 'C:\projects\review\jesse\esp-hal\esp-hal\src\clock\clocks_ll\esp32p4.rs', at line 375, column 53

PanicInfo {
    payload: Any { .. },
    message: Some(
        attempt to subtract with overflow,
    ),
    location: Location {
        file: "C:\\projects\\review\\jesse\\esp-hal\\esp-hal\\src\\clock\\clocks_ll\\esp32p4.rs",
        line: 375,
        col: 53,
    },
    can_unwind: true,
    force_no_backtrace: false,
}

Backtrace:

0x4001e4e0
0x4001e4e0 - core::panicking::panic
    at C:\Users\Bjoern\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panicking.rs:144
0x4000eb24
0x4000eb24 - esp_hal::clock::clocks_ll::esp32p4_rtc_freq_to_cpll_mhz::{{closure}}
    at C:\projects\review\jesse\esp-hal\esp-hal\src\clock\clocks_ll\esp32p4.rs:375
0x4000d928
0x4000d928 - esp32p4::generic::Reg<REG>::modify
    at C:\Users\Bjoern\.cargo\git\checkouts\esp-pacs-175859a47098a821\3bb2327\esp32p4\src\generic.rs:221
0x40004c42
0x40004c42 - esp_hal::clock::ClockControl::configure
    at C:\projects\review\jesse\esp-hal\esp-hal\src\clock\mod.rs:694
0x400058be
0x400058be - main
    at C:\projects\review\jesse\esp-hal\esp32p4-hal\examples\hello_world.rs:18
0x4000b074
0x4000b074 - hal_main
    at C:\projects\review\jesse\esp-hal\esp-hal\src\lib.rs:476
0x40000112
0x40000112 - _start_rust
    at C:\projects\review\jesse\esp-hal\esp-riscv-rt\src\lib.rs:70

🤷‍♂️

@jessebraham jessebraham marked this pull request as draft February 8, 2024 17:03
@MabezDev
Copy link
Member

MabezDev commented Feb 9, 2024

I guess this might be a clocks issue, @playfulFence would you mind looking into this?

@jessebraham
Copy link
Member Author

The panic seems to originate from the interrupt vectoring initialization, disabling the vectored feature fixes this. Not sure why it just started happening, but will need to resolve that.

Still, my UART is not working following my last rebase, so I will need to fix this again.

It seems that P4 support is lower-priority than some other tasks I have on the go, so this will probably just sit here as a draft for a bit, until I have time to return to it. If anybody else feels like debugging it and getting it the rest of the way there, please feel free!

@jessebraham
Copy link
Member Author

I'm not getting to this any time soon by the looks of it, and there have been changes to the UART driver in the meantime, so I'm just going to close this.

@jessebraham jessebraham closed this Mar 4, 2024
@jessebraham jessebraham deleted the feature/p4-uart branch May 2, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants