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

Parents
  • Hi

    Here Is my configuration,

    for Nor flash.

    i set DQ0 as MOSI

    i set DQ1 as MISO.

    i kept clock frequency as 1 Mbps.

    i set mode MODE0 means Sample data at rising edge of clock and shift serial data at falling edge

    i make wp pin,hold pin and chip select pin as pull up.

    then i am able to send data over MOSI which is i saw in CRO.

    but there is no data in MISO.

    I am trying to read device id as 0X20BA20. by sending read id command 0x9F.

    Kndly suggest me

    Regards Balaji

    n25q_512mb_1ce_3v_65nm.pdf

Reply
  • Hi

    Here Is my configuration,

    for Nor flash.

    i set DQ0 as MOSI

    i set DQ1 as MISO.

    i kept clock frequency as 1 Mbps.

    i set mode MODE0 means Sample data at rising edge of clock and shift serial data at falling edge

    i make wp pin,hold pin and chip select pin as pull up.

    then i am able to send data over MOSI which is i saw in CRO.

    but there is no data in MISO.

    I am trying to read device id as 0X20BA20. by sending read id command 0x9F.

    Kndly suggest me

    Regards Balaji

    n25q_512mb_1ce_3v_65nm.pdf

Children
Related