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

I2C - PSRAM error when SPIRAM_USE_MALLOC and ESP_INTR_FLAG_IRAM (IDFGH-6522) #8173

Closed
SunnyRuss opened this issue Dec 30, 2021 · 3 comments
Closed
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@SunnyRuss
Copy link

in the file I2C.C at line 1380 the code reads:

   if (cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_WRITE || cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_READ) {
        if (cmd_link->cmd.data != NULL && !esp_ptr_internal(cmd_link->cmd.data)) {
            return false;
        }
    }

I think it should be like this or similar:

   if ((cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_WRITE && !i2c_cmd_is_single_byte(&cmd_link->cmd)) || 
        cmd_link->cmd.hw_cmd.op_code == I2C_LL_CMD_READ) {
        if (cmd_link->cmd.data != NULL && !esp_ptr_internal(cmd_link->cmd.data)) {
            return false;
        }
    }

I believe this because when you write just one byte, the value of cmd.data is not a pointer, but the actual byte to be sent out over the I2C bus and that value will never be a valid esp_ptr_internal() address. As such, you always get a PSRAM buffer error.

This is in release/v4.4

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 30, 2021
@github-actions github-actions bot changed the title I2C - PSRAM error when SPIRAM_USE_MALLOC and ESP_INTR_FLAG_IRAM I2C - PSRAM error when SPIRAM_USE_MALLOC and ESP_INTR_FLAG_IRAM (IDFGH-6522) Dec 30, 2021
@o-marshmallow
Copy link
Collaborator

Hi @SunnyRuss ,
Thanks for reporting this, I am going to manage this issue

@espressif-bot espressif-bot added Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Dec 31, 2021
@AxelLin
Copy link
Contributor

AxelLin commented Feb 4, 2022

@o-marshmallow
v4.4 and v4.3 also need this fix.

dskulina pushed a commit to playable-tech/esp-idf that referenced this issue Feb 4, 2022
dskulina pushed a commit to playable-tech/esp-idf that referenced this issue Feb 5, 2022
@o-marshmallow
Copy link
Collaborator

Hi @AxelLin ,
A backport to v4.4 is on the way.
However, v4.3 doesn't need this fix since it doesn't have this "single-byte-in-pointer" feature.

espressif-bot pushed a commit that referenced this issue Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants