Hi: Recently, I want to use nRF52 to read or write some data from a flash chip(w25q128bv) by using spi, I've read Manufactures ID correctly, also, I have wrote a register of the flash chip and read back correctly, that means spi communication is ok. However, when the length wrote or read is longer than 255 bytes, I do nothing. I know, the spi list mode could solve my problem, but I don't know how to use it, no details, no examples, making me in a mass.
Here, I list my code as an example, in this example, what I want is to program a page(256 bytes) of this flash chip, totally 260 bytes need be sent.(1 byte for page program command, 3 bytes for address, 256 bytes for a page data)
nrf_gpio_pin_clear(NOR_FLASH_CS);
xfer_desc.p_tx_buffer = buffer;
xfer_desc.p_rx_buffer = NULL;
xfer_desc.rx_length = 0;
xfer_desc.tx_length = 130;
flags = NRF_DRV_SPI_FLAG_HOLD_XFER |
NRF_DRV_SPI_FLAG_TX_POSTINC |
NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER |
NRF_DRV_SPI_FLAG_REPEATED_XFER;
ret = nrf_drv_spi_xfer(&spi, &xfer_desc, flags);
if (ret == NRF_SUCCESS)
{
err_code = nrf_drv_ppi_channel_assign(m_flash_tx_ppi_channel,nrf_drv_spi_end_event_get(&spi), nrf_drv_spi_start_task_get(&spi));
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_ppi_channel_enable(m_flash_tx_ppi_channel);
APP_ERROR_CHECK(err_code);
nrf_spim_task_trigger(spi.p_registers, NRF_SPIM_TASK_START);
err_code = nrf_drv_ppi_channel_disable(m_flash_tx_ppi_channel);
APP_ERROR_CHECK(err_code);
}
nrf_gpio_pin_set(NOR_FLASH_CS);
I control cs pin and trig transfer manually, and do several experiment wiith different tx_length, however, this code didn't work. who can give me some suggestions or a reference?
Thank you very much!