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

Spi read is not happening fine,

Hi

We have custom nrf51822 board.

in that we have nor flash which is spi compatible.

so in order to read device id i used spi_master sample source code.

i am able to write data in to Nor flash.

i check with debugging also.

it is giving ack for every byte write.

but i a not able to read data from nor.

i am trying to read device id of nor.

Here is my code

int main(void) { uint32_t *spi_base_address; NRF_GPIO->PIN_CNF[30]=0; NRF_GPIO->OUTCLR=(1<<30); bool lsb_first=0; uint16_t transfer_size1=1; uint8_t data=0x06;//SPI_FLASH_INS_WREN; uint8_t recvbuf[3]={0x00}; uint8_t *tx_data1=&data; uint16_t transfer_size=3; uint8_t SPI_FLASH_INS_RDID[5]={0x9F,0x00,0x00,0x00,0x00}; uint8_t *tx_data=&SPI_FLASH_INS_RDID[0]; uint8_t *rx_data=&recvbuf[0];

spi_base_address=spi_master_init(SPI0,SPI_MODE0,lsb_first);
//spi_master_tx_rx(spi_base_address,transfer_size1,tx_data1,rx_data);

spi_master_tx_rx(spi_base_address,transfer_size,tx_data,rx_data);
      while(true)
      {
    }

}

i configured currect gpio pin spi_master_config.h

Kindly suggest me.if anyone have simple spi code for eeprom or some other hardware kindly share with me

Regards Balaji

Related