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

psram-80mhz feature is broken for octal psram. #1868

Closed
liebman opened this issue Jul 28, 2024 · 1 comment
Closed

psram-80mhz feature is broken for octal psram. #1868

liebman opened this issue Jul 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@liebman
Copy link
Contributor

liebman commented Jul 28, 2024

Enabling psram-80mhz with octal psram (opsram-8m in this case) results in a hang calling ALLOCATOR.init() Removing the psram-80mhz feature works but psram is at 40MHz instead of the wanted 80Mhz.

Hardware: esp32-s3-wroom-1-N16R8

Flashed with: cargo espflash flash --flash-size 16mb --flash-freq 80mhz --monitor --release
the result fails to print "Done" and "Hello World" indicating its not returned from ALLOCATOR.init().

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x2b (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x16f8
load:0x403c9700,len:0x4
load:0x403c9704,len:0xc00
load:0x403cc700,len:0x2eb0
entry 0x403c9908
I (27) boot: ESP-IDF v5.1-beta1-378-gea5e0ff298-dirt 2nd stage bootloader
I (27) boot: compile time Jun  7 2023 08:07:32
I (28) boot: Multicore bootloader
I (32) boot: chip revision: v0.2
I (36) boot.esp32s3: Boot SPI Speed : 80MHz
I (41) boot.esp32s3: SPI Mode       : DIO
I (46) boot.esp32s3: SPI Flash Size : 16MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (74) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (82) boot:  2 factory          factory app      00 00 00010000 00fa0000
I (89) boot: End of partition table
I (93) esp_image: segment 0: paddr=00010020 vaddr=3c010020 size=03290h ( 12944) map
I (104) esp_image: segment 1: paddr=000132b8 vaddr=3fc8a3e0 size=0000ch (    12) load
I (110) esp_image: segment 2: paddr=000132cc vaddr=40378000 size=023e0h (  9184) load
I (121) esp_image: segment 3: paddr=000156b4 vaddr=00000000 size=0a964h ( 43364) 
I (135) esp_image: segment 4: paddr=00020020 vaddr=42000020 size=04f34h ( 20276) map
I (140) boot: Loaded app from partition at offset 0x10000
I (141) boot: Disabling RNG early entropy source...
INFO - Initializing psram
INFO - vendor id    : 0d (AP)
INFO - dev id       : 02 (generation 3)
INFO - density      : 03 (64 Mbit)
INFO - good-die     : 01 (Pass)
INFO - Latency      : 01 (Fixed)
INFO - VCC          : 01 (3V)
INFO - SRF          : 01 (Fast Refresh)
INFO - BurstType    : 01 (Hybrid Wrap)
INFO - BurstLen     : 01 (32 Byte)
INFO - Readlatency  : 02 (10 cycles@Fixed)
INFO - DriveStrength: 00 (1/1)
INFO - 8388608 bytes of PSRAM
INFO - Initializing allocator

main.rs

#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_hal::{
    clock::ClockControl, delay::Delay, peripherals::Peripherals, prelude::*, system::SystemControl,
};
use log::info;

extern crate alloc;

#[global_allocator]
static ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();

#[entry]
fn main() -> ! {
    esp_println::logger::init_logger(log::LevelFilter::Info);
    let peripherals = Peripherals::take();

    let system = SystemControl::new(peripherals.SYSTEM);

    let clocks = ClockControl::max(system.clock_control).freeze();
    let delay = Delay::new(&clocks);

    info!("Initializing psram");
    esp_hal::psram::init_psram(peripherals.PSRAM);
    info!("Initializing allocator");
    unsafe {
        ALLOCATOR.init(
            esp_hal::psram::psram_vaddr_start() as *mut u8,
            esp_hal::psram::PSRAM_BYTES,
        );
    }
    info!("init_heap: Done");

    info!("Hello world!");

    loop {
        delay.delay(1000.millis());
    }
}

Cargo.toml

[package]
name = "psram80mhz"
version = "0.1.0"
authors = ["liebman <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
esp-backtrace = { version = "0.13.0", features = [
    "esp32s3",
    "exception-handler",
    "panic-handler",
    "println",
] }
esp-hal = { version = "0.19.0", features = [ "esp32s3", "debug", "log", "opsram-8m", "psram-80mhz" ] }
esp-println = { version = "0.10.0", features = ["esp32s3", "log"] }
log = { version = "0.4.21" }
esp-alloc = { version = "0.4.0" }
[profile.dev]
# Rust debug is too slow.
# For debug builds always builds with some optimization
opt-level = "s"

[profile.release]
codegen-units = 1 # LLVM can perform better optimizations using a single thread
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false

espflash.toml

[flash]
mode = "dio"
size = "16MB"
frequency = "80MHz"
@jessebraham jessebraham added the bug Something isn't working label Jul 28, 2024
@MabezDev
Copy link
Member

MabezDev commented Aug 8, 2024

I believe this is a duplicate of #1566

@MabezDev MabezDev closed this as completed Aug 8, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants