About custom instruction of QSPI and dummy byte

Hi,

I'm implementing QSPI using nRF52840 and MT29F8G01ADAFD12.

  • SDK version : 17.1.0
  • Soft device : s140 7.2.0

I'm wondering about custom instruction.

I'm implementing reading the ID of device.

void QspiMemory_init(void){
	nrf_drv_qspi_config_t config = NRF_DRV_QSPI_DEFAULT_CONFIG;
	uint8_t temporary = 0x00;
	uint32_t err_code;
	nrf_qspi_cinstr_conf_t cinstr_cfg = {
		.opcode    = MT29F_RESET,
		.length    = NRF_QSPI_CINSTR_LEN_1B,
		.io2_level = false,
		.io3_level = false,
		.wipwait   = true,
		.wren      = true
	};
	
	err_code = nrf_drv_qspi_init(&config, qspi_handler, NULL);
	APP_ERROR_CHECK(err_code);
	
	
	// Send reset enable
	//err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
	//APP_ERROR_CHECK(err_code);
	
	cinstr_cfg.opcode = MT29F_READ_ID;
	cinstr_cfg.length = NRF_QSPI_CINSTR_LEN_3B;
	err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, m_buffer_rx);
	APP_ERROR_CHECK(err_code);

}

I implemented the code like this, but the data was not read.

In datasheet, for reading device's id, enter opcode(READ_ID) + dummy byte.

How can i send dummy byte?

I also run this code for sending dummy byte.

err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, &dummy, m_buffer_rx);
APP_ERROR_CHECK(err_code);

My question is

  1. Is it right to use nrf_drv_qspi_cinstr_xfer(..., &dummy, ...)to transmit dummy data?
  2. Does NRF_QSPI_CINSTR_LEN_4B mean length of frame?
    (Should I set the length to NRF_QSPI_CINSTR_LEN_4B(opcode + dummy + manufacture id + device id)?

This is my schematic.

Regards,

Youngjun.

  • Hi Youngjun

    I'm afraid we don't support setting up NAND flash devices with our QSPI, as the configuration and setup is exponentially more complicated than with NOR flash devices, so I'm afraid you're mostly on your own here. We strongly recommend using a NOR flash, as the only use case I've seen a NAND flash work, in practice took away the "quad" feature in QSPI, as you'll likely be left with the speeds available in normal SPI.

    Here's what I know about your questions:

    1. I think though, that you can configure the number of dummy cycles on the memory side in the flash device's Nonvolatile Configuration Register. I think you can try increasing this to get a dummy cycle after a command. 

    2. The NRF_QSPI_CINSTR_LEN parameter is the length of your custom instruction, where one of the bytes is the OP code, and the rest are custom instruction data.

    Best regards,

    Simon

Related