This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Separate SPIM command to Rx and Tx

Hi

I using nRF52840-DK with 64 Mb external flash memory.

I'm using SPI interface for read / write command with the external flash.

When I'm using single command for write and read it working well 

uint8_t spi_tx_cmd[] = {CMD_REMS, 0x00, 0x00, CMD_REMS_ADDRESS_DEFAULT};  
uint8_t spi_rx_response[6];  
  
nrfx_spim_xfer_desc_t xfer_desc = NRFX_SPIM_XFER_TRX(spi_tx_cmd, sizeof(spi_tx_cmd), spi_rx_response, sizeof(spi_rx_response));  
nrfx_spim_xfer(&m_spim_mx, &xfer_desc, 0);  
  
manufacturer_id = spi_rx_response[4];  
device_id = spi_rx_response[5];  

but when I'm trying to separate the commands to write and then read, I don't receive an answer when reading


uint8_t spi_tx_cmd[] = {CMD_REMS, 0x00, 0x00, CMD_REMS_ADDRESS_DEFAULT};
uint8_t spi_rx_response[2];

nrfx_spim_xfer_desc_t xfer_desc_tx = NRFX_SPIM_XFER_TX(spi_tx_cmd, sizeof(spi_tx_cmd));
nrfx_spim_xfer(&m_spim_mx, &xfer_desc_tx, 0);
nrfx_spim_xfer_desc_t xfer_desc_rx = NRFX_SPIM_XFER_RX(spi_rx_response, sizeof(spi_rx_response));
nrfx_spim_xfer(&m_spim_mx, &xfer_desc_rx, 0);

manufacturer_id = spi_rx_response[0];
device_id = spi_rx_response[1];

Any suggestions why it may not work?

Thanks

Related