<?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>BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59372/bno080-sh-2-over-twim</link><description>Hi 
 Has anyone developed or worked with a BNO080 using Hilcrest&amp;#39;s SH-2 Protocol over TWIM? I&amp;#39;m having real challenges getting consistent responses. I&amp;#39;ve developed (based on what I can find on the internet) the basics of a library. But every time I run</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 Sep 2020 08:04:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59372/bno080-sh-2-over-twim" /><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/271449?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2020 08:04:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c03e858-8169-46af-a263-0a1c1acd0ae7</guid><dc:creator>WQvist</dc:creator><description>&lt;p&gt;Did you ever get it to work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241325?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 10:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee02c7d9-1a31-415d-9bf5-de5e4c4f6008</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Hi, it does respond to its appropriate address now I&amp;#39;ve capture the event using the event handler. I&amp;#39;m rebuilding the code and have connected the hardware interrupt from the BNO080, to check its in a ready state before sending data.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll come back with the code so it can be shared once its working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241320?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 10:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ee914da-49b1-4c0b-8873-4868034c64e6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Have you looked in the datasheet for your sensor? What addess is it supposed to be on? And have you analyzed the TWI wires? Does the data there look like it is supposed to?&lt;/p&gt;
&lt;p&gt;I wouldn&amp;#39;t strip away to much from the&amp;nbsp;twi_scanner example. Try the unmodified one. does the sensor actually reply to all those addresses?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241307?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 09:52:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aef5d68f-d05e-4267-bca7-83c1c0bd35ee</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Okay, I&amp;#39;ve worked out the Scanning issue:&lt;/p&gt;
&lt;p&gt;I have added in an event capture into the twi instance config:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;err_code = nrf_drv_twi_init(&amp;amp;m_twi_instance, &amp;amp;twi_mpu_config, nrf_drv_mpu_twi_event_handler, &lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;Therefore the scanner will always return success, and I will need to check &amp;quot;&lt;/span&gt;&lt;/span&gt;NRF_DRV_TWI_EVT_DONE&amp;quot;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I&amp;#39;ll continue to build from here!&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241225?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 17:44:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6e09e22-c060-459b-96fb-62232df5dcbc</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve stripped everything back and am using nrf_drv_twi for driving TWI, also removed all code from main.c so it just runs &amp;#39;nrf_drv_mpu_init&amp;#39; and &amp;#39;twi_scaner&amp;#39; (see .c below).&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;bno080-nrf-twi.h&amp;quot;
#include &amp;quot;nrf_drv_twi.h&amp;quot;

 #define TWI_ADDRESSES      127

static const nrf_drv_twi_t m_twi_instance = NRF_DRV_TWI_INSTANCE(0);
volatile static bool twi_tx_done = false;
volatile static bool twi_rx_done = false;

uint8_t twi_tx_buffer[MPU_TWI_BUFFER_SIZE];

/**
 * @brief TWI Event Handler.
 * Just the usual way. Nothing special here
 */
static void nrf_drv_mpu_twi_event_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
    switch(p_event-&amp;gt;type)
    {
        case NRF_DRV_TWI_EVT_DONE:
            switch(p_event-&amp;gt;xfer_desc.type)
            {
                case NRF_DRV_TWI_XFER_TX:
                    twi_tx_done = true;
                    break;
                case NRF_DRV_TWI_XFER_TXTX:
                    twi_tx_done = true;
                    break;
                case NRF_DRV_TWI_XFER_RX:
                    twi_rx_done = true;
                    break;
                case NRF_DRV_TWI_XFER_TXRX:
                    twi_rx_done = true;
                    break;
                default:
                    break;
            }
            break;
        case NRF_DRV_TWI_EVT_ADDRESS_NACK:
            break;
        case NRF_DRV_TWI_EVT_DATA_NACK:
            break;
        default:
            break;
    }
}


/**
 * @brief TWI initialization.
 * Just the usual way. Nothing special here
 */
uint32_t nrf_drv_mpu_init(void)
{
    uint32_t err_code;
    
    const nrf_drv_twi_config_t twi_mpu_config = {
       .scl                = TWI_SCL_PIN,
       .sda                = TWI_SDA_PIN,
       .frequency          = NRF_TWI_FREQ_400K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGHEST,
       .clear_bus_init     = false
    };
    
    err_code = nrf_drv_twi_init(&amp;amp;m_twi_instance, &amp;amp;twi_mpu_config, nrf_drv_mpu_twi_event_handler, NULL);
    if(err_code != NRF_SUCCESS)
	{
		return err_code;
	}
    
    nrf_drv_twi_enable(&amp;amp;m_twi_instance);

    NRF_LOG_INFO (&amp;quot;nrf_drv_mpu_init&amp;quot;);
	
	return NRF_SUCCESS;
}

/**
 * @brief TWI Scanner.
 * Just the usual way. Nothing special here
 */
uint32_t twi_scanner()
{

    uint32_t err_code;
    uint8_t address;
    uint8_t sample_data;
    bool detected_device = false;

    NRF_LOG_INFO(&amp;quot;twi_scanner&amp;quot;);

    for (address = 1; address &amp;lt;= TWI_ADDRESSES; address++)
    {
        err_code = nrf_drv_twi_rx(&amp;amp;m_twi_instance, address, &amp;amp;sample_data, sizeof(sample_data));
        if (err_code == NRF_SUCCESS)
        {
            detected_device = true;
            NRF_LOG_INFO(&amp;quot;TWI device detected at address 0x%x.&amp;quot;, address);
        }
        NRF_LOG_FLUSH();
    }

    if (!detected_device)
    {
        NRF_LOG_INFO(&amp;quot;No device was found.&amp;quot;);
        return NRF_ERROR_INVALID_ADDR;
    }

    return NRF_SUCCESS;

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I not get the TWI Scanner reporting its found a device at every address...I&amp;#39;m really confused.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241205?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 15:34:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c742ff2b-036d-4a88-a8ec-f019463286a9</guid><dc:creator>aplatts</dc:creator><description>&lt;p&gt;Hi Edvin&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think my implementation of&amp;nbsp;nrfx_twim is wrong as I have tried a different TWI device which I have had working before, but I&amp;#39;m not getting the appropriate addresses even from a simple scan.&lt;/p&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;p&gt;info&amp;gt; app: twi_scanner &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x1. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x16. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x2B. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x3C. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x51. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x66. &lt;br /&gt;&amp;lt;info&amp;gt; app: TWI device detected at address 0x77.&lt;/p&gt;
&lt;p&gt;There is only one device connected on TWI,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve double checked my TWI peripheral with older working nrf_twi code and found the device successfully on port&amp;nbsp; 0x4B. I&amp;#39;ve seen notes that nrfx doesn&amp;#39;t play well with Softdevices. I&amp;#39;m using S140 for BLE from SDK 16.0.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BNO080 SH-2 over TWIM</title><link>https://devzone.nordicsemi.com/thread/241201?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 15:27:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff8a3484-6c7a-4e55-98a2-300e533a2db3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I suggest that you try to find a driver for the BMO080. Have you tried to analyze the TWI lines? Is there any data going on the lines? Does it correspond with what you&amp;#39;d expect to see?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>