<?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>Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41417/bma2x2-drivers-and-twi</link><description>HI, Im developing a custom board (NRF58232) with a bmx055 connected by TWI. 
 I have used the twi_scanner and twi_sensor and all OK, It was working ! 
 But now I want to use the Bosch drivers API to a better implementation. 
 I can see that, the only</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Dec 2018 08:35:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41417/bma2x2-drivers-and-twi" /><item><title>RE: Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/thread/161600?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 08:35:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b448f1c-0741-4cb4-abcf-171c3b7e3ef9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, the naming of the examples and libraries is unfortunate. The twi_sensor &lt;em&gt;example&lt;/em&gt; does not use the twi_sensor &lt;em&gt;library, &lt;/em&gt;and that is not obvious at all before you look at the code. In your case you need the functionality from the twi_sensor library, so it is much better to use that than to just use the driver than having to implement everything yourself.&lt;/p&gt;
&lt;p&gt;The TWI sensor example is based on the nrf_drv_twi because the sensor is so simple that it does not need the TWI sensor library functions (which essentially is to combine read and write operations so that you can write the register address to the sensor first, telling it what you want to read). The TWI sensor library use the TWI driver internally.&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;nrf_drv_twi functions will not disappear in the near future. You might be thinking of the nrfx driver layer, which is used by nrf_drv_twi and the other &amp;quot;legacy&amp;quot; drivers. The reason for making nrfx is to make a driver package that is SDK independent. For instance it is used together with the Zephyr RTOS in addition to the nRF5 SDK. The legacy drivers will not disappear from the nRF5 SDK.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/thread/161589?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 07:19:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83bb5afa-965a-4c3f-aa43-711448d47e0b</guid><dc:creator>navarrocantero</dc:creator><description>&lt;p&gt;Hi, the first, thanks for your reply !&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Yes, mi code is based in nrf_drv_twi_* functions because Its based in the &amp;lt;SDK&amp;gt;\examples\peripheral\twi_sensor&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But, why these example its based in the nrf_drv_twi instead of twi_sensor directly??&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I saw the drivers that you said me, and for now, I dont know how can use with my drivers for now , but I will do it, dont close the issue yet !&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The nrf_drv_twi functions will dissapear in new sdk versions ? I have readed something like that in this forum.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/thread/161229?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 14:07:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6269b208-80af-46b5-bee5-a7bb9a0041c4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I do not see any trace of you actually trying to use the twi_sensor library. The code snippets you have pasted use the twi_driver (nrf_drv_twi_* functions) directly instead of the twi_sensor library. Using the twi_sensor library will save you a lot of time.&lt;/p&gt;
&lt;p&gt;Unfortunately, I am not able to test on my side, but look at how the twi_sensor library is used in other drivers in the SDK. You can find several examples under &amp;lt;SDK&amp;gt;\components\drivers_ext\. I am happy to help if you face any difficulties and have specific questions regarding the implementation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/thread/161222?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 13:44:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df8322a1-3579-4dfa-a65f-4c6cc2959a08</guid><dc:creator>navarrocantero</dc:creator><description>&lt;p&gt;Yes I Understand the driver in the same way&amp;nbsp; !!&amp;nbsp; And yes, I think too that the twi_sensor its perfect because have all the necesary librarys for this work&lt;br /&gt;&lt;br /&gt;Buts the bosch implementation file example&amp;nbsp;not clear at all&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The steps to work bosch drivers with nordic_sdk will be:&lt;/p&gt;
&lt;p&gt;1- Init twi like normally&amp;nbsp; I would in nordic sdk&lt;/p&gt;
&lt;p&gt;2- implement write and read functions but Im stucked on this step, for example:&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Bosch says :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;s8 BMA2x2_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) {
    s32 iError = BMA2x2_INIT_VALUE;
    u8 array[I2C_BUFFER_LEN] = {BMA2x2_INIT_VALUE};
    u8 stringpos = BMA2x2_INIT_VALUE;

    array[BMA2x2_INIT_VALUE] = reg_addr;
    /* Please take the below function as your reference
     * for read the data using I2C communication
     * add your I2C rad function here.
     * &amp;quot;IERROR = I2C_WRITE_READ_STRING(DEV_ADDR, ARRAY, ARRAY, 1, CNT)&amp;quot;
     * iError is an return value of SPI write function
     * Please select your valid return value
     * In the driver SUCCESS defined as 0
     * and FAILURE defined as -1
     */

    for (stringpos = BMA2x2_INIT_VALUE; stringpos &amp;lt; cnt; stringpos++)
        *(reg_data + stringpos) = array[stringpos];
    return (s8) iError;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but, Normally, in the nordic SDK i will read like this :&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    ret_code_t
    err_code = nrf_drv_twi_tx(&amp;amp;m_twi, BMX055_ACC_ADDRESS, &amp;amp;data_11, sizeof(data_11), true);
    nrf_delay_ms(10);
    if (err_code == NRF_SUCCESS) {
        nrf_drv_twi_rx(&amp;amp;m_twi, BMX055_ACC_ADDRESS, &amp;amp;rawData, sizeof(rawData));
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Im on the same situation that yesterday, I dont see clear how can &amp;#39;merge&amp;#39; drivers into the SDK, and I dont found any relevant information.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In any case, thanks for your response !!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bma2x2 drivers and TWI</title><link>https://devzone.nordicsemi.com/thread/161199?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 13:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:802f6765-6b19-4c92-836d-9e0765488f6b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The way I understand the&amp;nbsp;BMA2x2 driver you just have to implement the&amp;nbsp;BMA2x2_I2C_bus_read() and&amp;nbsp;BMA2x2_I2C_bus_write() functions. Please refer to the TWI documentation and examples in the SDK to see how it is used. It seems like the TWI sensor library (&amp;lt;SDK&amp;gt;\components\libraries\twi_sensor\) should match well, so I suggest you&amp;nbsp;consider using that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>