<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>No MISO Responce</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74192/no-miso-responce</link><description>Hello, support team:) 
 
 Currently I am working on SPI communication with LSM6DSOXTR. 
 CLK, MOSI, SS is working as expected. But there is no MISO signal. 
 
 0) All SPI PIN is configured as NRF_PIN_DISCON_NOPULL 
 1) SPI Read function 
 
 
 static int32_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Apr 2021 08:58:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74192/no-miso-responce" /><item><title>RE: No MISO Responce</title><link>https://devzone.nordicsemi.com/thread/306021?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 08:58:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbda97a5-1f7e-44b0-8e0a-cee6b07fc62f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;What is the context in which you are calling&amp;nbsp;&lt;span&gt;lsm_read? probably the answer to that question might give some hints as to why replacing __WFE with busy delay helps in your case. I have not seen into the timing requirement of your sensor.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;5us delay does not look bad in a lower priority threads, so if it works, keep it.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No MISO Responce</title><link>https://devzone.nordicsemi.com/thread/305967?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 00:34:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4b359ac-4d8d-4155-8675-31925c98b80b</guid><dc:creator>JIYEON</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Read function is updated. Now WHO_AM_I is read correctly.&lt;/p&gt;
&lt;p&gt;But It seems like write function doesn&amp;#39;t work correctly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I wonder why delay should be done between each 8 bit in read function?&lt;/p&gt;
&lt;p&gt;And how could I fix write function?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int32_t lsm_write(void *handle, uint8_t reg, uint8_t *bufp, uint16_t len)
{
    ret_code_t err_code;
    uint8_t s_tx_buf[I2C_TX_LEN_MAX];
    uint8_t i;

    // Data to send: Register address + contents.
    s_tx_buf[0] = (reg ^ 0x80);
    memcpy(&amp;amp;s_tx_buf[1], bufp, len);
    
    nrf_gpio_pin_write(PIN_LSM_SPI_SS, 0);

    //spi1_xfer_done = false;

    //err_code = nrf_drv_spi_transfer(&amp;amp;m_spi_lsm, s_tx_buf, len + 1, &amp;amp;no_use, 1);
    //RETURN_IF_ERROR(err_code);

    //while (!spi1_xfer_done)
    //{
    //    __WFE();
    //}
    
    nrf_delay_us(5);

    for(i = 0; i &amp;lt; len + 1; i ++)
    {
        spi1_xfer_done = false;

        err_code = nrf_drv_spi_transfer(&amp;amp;m_spi_lsm, &amp;amp;(s_tx_buf[i]), 1, NULL, 0);
        RETURN_IF_ERROR(err_code);

        while (!spi1_xfer_done)
        {
            __WFE();
        }
    
        nrf_delay_us(1);
    }
    
    nrf_delay_us(5);

    nrf_gpio_pin_write(PIN_LSM_SPI_SS, 1);

    return DRV_ACC_STATUS_CODE_SUCCESS;   
}

static int32_t lsm_read(void *handle, uint8_t reg, uint8_t *bufp, uint16_t len)
{
    ret_code_t err_code;
    uint8_t s_tx_buf;
    uint8_t read_temp[I2C_TX_LEN_MAX] ;
    uint8_t i;

    s_tx_buf = (reg | 0x80);
    
    nrf_gpio_pin_write(PIN_LSM_SPI_SS, 0);

    nrf_delay_us(5);
    
    //spi1_xfer_done = false; 

    //err_code = nrf_drv_spi_transfer(&amp;amp;m_spi_lsm, &amp;amp;s_tx_buf, 1, read_temp, len+1);
    //RETURN_IF_ERROR(err_code);

    //while (!spi1_xfer_done)
    //{
    //    __WFE();
    //}

    //for(i = 1 ; i &amp;lt; len + 1 ; i ++ )
    //{
    //    bufp[i-1] = read_temp[i] ;
    //}  
    
    spi1_xfer_done = false; 

    err_code = nrf_drv_spi_transfer(&amp;amp;m_spi_lsm, &amp;amp;s_tx_buf, 1, NULL, 0);
    RETURN_IF_ERROR(err_code);

    while (!spi1_xfer_done)
    {
        __WFE();
    }
    
    nrf_delay_us(10);
    
    for(i = 0; i &amp;lt; len ; i ++ )
    {   
        spi1_xfer_done = false; 

        err_code = nrf_drv_spi_transfer(&amp;amp;m_spi_lsm, NULL, 0, &amp;amp;bufp[i], 1);
        RETURN_IF_ERROR(err_code);

        while (!spi1_xfer_done)
        {
            __WFE();
        }
    
        nrf_delay_us(1);
    }
    
    nrf_delay_us(5);

    nrf_gpio_pin_write(PIN_LSM_SPI_SS, 1);
    
    return DRV_ACC_STATUS_CODE_SUCCESS;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>