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

nRF52 QSPI transport fails to operate in 1BIT I/O mode #104

Open
lyusupov opened this issue Sep 8, 2021 · 3 comments
Open

nRF52 QSPI transport fails to operate in 1BIT I/O mode #104

lyusupov opened this issue Sep 8, 2021 · 3 comments
Labels

Comments

@lyusupov
Copy link
Contributor

lyusupov commented Sep 8, 2021

Operating System

Linux

IDE version

Arduino 1.6+

Board

nRF52840

BSP version

1.0.0

SPIFlash Library version

Latest

Sketch

msc_external_flash.ino from Adafruit_TinyUSB_Arduino examples.

What happened ?

Adafruit_FlashTransport_QSPI_NRF.cpp always uses 'hard-coded' 4-bits data R/W transfer:

      .prot_if = {.readoc = NRF_QSPI_READOC_READ4O, // 0x6B read command
                  .writeoc = NRF_QSPI_WRITEOC_PP4O, // 0x32 write command

regardless of the

.supports_qspi = false,

defined in the flash_devices.h

The _supports_qspi _ variable has an effect on STATUS REGISTER value, but not on the R/W COMMANDs data width.

To maintain compatibility with 1BIT data transfer mode I would suggest to initialize the nRF52 QSPI transport as follows:

      .prot_if = {.readoc = NRF_QSPI_READOC_FASTREAD, // 0x0B read command
                  .writeoc = NRF_QSPI_WRITEOC_PP, // 0x02 write command

then update the data transfer method if the .supports_qspi is true for flash IC been detected.

How to reproduce ?

build and run sketch listed above.

Debug Log

No response

Screenshots

No response

@lyusupov lyusupov added the Bug label Sep 8, 2021
@hathach
Copy link
Member

hathach commented Sep 9, 2021

Can you submit an PR for this, to be honest, this 1bit IO is not very useful. People should just use spi instead

@lyusupov
Copy link
Contributor Author

lyusupov commented Sep 9, 2021

I am not enough famliar with the library API to submit an elegant solution. That's why I rely on your discretion.

When every SPIM module of nRF52 is in use - there is no other way to operate SPI flash other than being connected to QSPI transport.
nRF52 QSPI module does work independent of SPIM modules.

@hathach
Copy link
Member

hathach commented Sep 9, 2021

since Adafruit does not make any board that need this 1bit IO communication, there is no motivation for me to write such as code. If you are worried about the code, just make an PR as best as you could. I could help shaping it with review.

PS: since I don't have required hardware to verify, please make sure you test it with actual hardware when making PR.

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