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

SPI flash drive implementation problem

I want to use nrf SPI driver for SPI flash implementation. For that want to send either SPI transmit or SPI receive at single instance to write or read flash address. But in nrf spi divers , single driver function is available for both transmit and receive...as below,

__STATIC_INLINE ret_code_t nrf_drv_spi_transfer	(	nrf_drv_spi_t const *const 	p_instance,
uint8_t const * 	p_tx_buffer,
uint8_t 	tx_buffer_length,
uint8_t * 	p_rx_buffer,
uint8_t 	rx_buffer_length 
)

For SPI flash write functionality, only transmit functionality require to send address and data, so I defined receiving parameters are NULL herewith. Same reverse thing is apply at the time of receive. But I didn't get proper data when I am trying to read data from flash. 

 

Can you please suggest how should I use this SPI driver for either transmit or receive functionality.

 

Thanks & Regards,

Pooja Uchagaonkar

  • For SPI flash write functionality, only transmit functionality require to send address and data, so I defined receiving parameters are NULL herewith. Same reverse thing is apply at the time of receive. But I didn't get proper data when I am trying to read data from flash. 

     I don't quite understand what you've done, can you re-phrase this paragraph? 

  • Sorry for inconvenience Sir,

    I was interfacing SPI flash memory with nRF52840. At the time of send command and register address to SPI flash, I defined NULL at *p_rx_buffer & rx_buffer_length because I wanted to only transfer data to flash. Once  the command is successfully send to SPI flash then I want to receive data from flash memory. So I defined NULL at * p_tx_buffer & tx_buffer_length and trying to receive data at p_rx_buffer.

    I didn't get proper data from flash but problem is resolved now.

    Thanks for support.

    Regards,

    Pooja Uchagaonkar

Related