zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.88k stars 6.63k forks source link

rp2040.dtsi defines wrong number of IRQ priority bits #65623

Closed renestraub closed 11 months ago

renestraub commented 12 months ago

Describe the bug

The RP2040 dtsi (zephyr\dts\arm\rpi_pico\rp2040.dtsi) defines the wrong number of IRQ priority bits.

&nvic {
    arm,num-irq-priority-bits = <3>;
};

However RP2040 CM0+ implements only 2 bits. Thus IRQ priority settings are wrong in general. The RPI_PICO_DEFAULT_IRQ_PRIORITY (equals to 3) becomes 1.

From the RP2040 datasheet (build-date: 2023-03-02), section 2.4.5

M0PLUS: NVIC_IPR0 Register
Offset: 0xe400
Description
Use the Interrupt Priority Registers to assign a priority from 0 to 3 to each of the available interrupts. 0 is the highest
priority, and 3 is the lowest.
Note: Writing 1 to an NVIC_ICPR bit does not affect the active state of the corresponding interrupt.
These registers are only word-accessible

Expected behavior

&nvic {
    arm,num-irq-priority-bits = <2>;
};

Impact IRQ priorities don't work as expected. RPI_PICO_DEFAULT_IRQ_PRIORITY (defined as 3) becomes 1.

Logs and console output

**Environment - OS: Windows - Zephyr SDK - * 1a0b1124c6 - (13 days ago) MAINTAINERS: charger: Adds entry for "Chargers" - Ricardo Rivera-Matos (HEAD -> main, origin/main, origin/HEAD)
github-actions[bot] commented 12 months ago

Hi @renestraub! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

yonsch commented 11 months ago

@renestraub Thanks for reporting this! Fixed here: #65785