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

spi_nand_flash with standard spi mode (IEC-164) #375

Open
txf- opened this issue Sep 11, 2024 · 3 comments
Open

spi_nand_flash with standard spi mode (IEC-164) #375

txf- opened this issue Sep 11, 2024 · 3 comments
Labels

Comments

@txf-
Copy link

txf- commented Sep 11, 2024

Is your feature request related to a problem?

I have noticed that the SPI nand flash driver is configured for half duplex via quad spi.

Describe the solution you'd like.

I'd like the driver to support transactions via standard SPI. Is that possible?

Describe alternatives you've considered.

I've tried modifying the example to use standard SPI, but there are warnings about difference in rx_buffer size vs tx_buffer.

spi_master: check_trans_valid(1039): rx length > tx length in full duplex mode

Additional context.

No response

@txf- txf- added the Type: Feature Request Feature request for a component label Sep 11, 2024
@github-actions github-actions bot changed the title spi_nand_flash with standard spi mode spi_nand_flash with standard spi mode (IEC-164) Sep 11, 2024
@igrr
Copy link
Member

igrr commented Sep 27, 2024

@txf- Sorry for the late response. I think it should be possible to use the standard SPI mode, but the part of the driver which sends SPI transactions needs to be modified. Currently the "write" (MOSI) and "read" (MISO) buffers are provided to spi_nand_execute_transaction function separately. In full duplex (standard SPI) mode, the lengths of these buffers should be the same. We would need to change the API of spi_nand_execute_transaction somewhat to allow for this. Alternatively, spi_nand_execute_transaction could allocate a temporary buffer of MAX(rx_len, tx_len) bytes and use it for the transaction, but that would result in higher heap memory usage. We also need to add a configuration field in spi_nand_flash_config_t so that the NAND driver knows whether the SPI bus is set up as full or half duplex, and change spi_nand_* functions to take the whole spi_nand_flash_device_t instead of just the SPI handle.

@txf-
Copy link
Author

txf- commented Sep 27, 2024

@txf- Sorry for the late response.

It's no problem, I have since looked in the library. I was under the impression that it was half duplex because the Dual and Quad spi modes needed it and I was only using it in normal spi mode.

But since then I noticed that this driver doesn't actually use the dual/quad spi commands such as "Fast Read Quad Output (6Bh)" etc. I might be using dual or quad in the future.

Is there any barrier to changing the driver to use these commands?

@igrr
Copy link
Member

igrr commented Sep 27, 2024

No, no specific barrier. The code of this component has mostly been contributed in espressif/esp-idf#9422 and we have used it largely "as is". Based on the open issues in this repo, it seems it is getting more use than we have expected, so we will try to provide more support from our side in the future.

Regarding QIO mode, I don't have a lot of experience with NAND flash, but for SPI NOR flash there is sometimes a difference between vendors in enabling the QIO mode. I guess that might need to be accounted for in the driver if those modes are used. If you end up implementing the commands specific to dual/quad modes, a PR or a patch would be welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants