<?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>Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72979/connectivity-nrf52840-with-bma400-accelerometer-via-i2c-bus</link><description>Hi, 
 
 I start to work on the NRF52840 and I would like to read register of BMA400 in burst mode (I mean possibility to read further register in one sequence) 
 I am novice in C language :-) 
 Currently, I can read a register but only one 
 I use the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Apr 2022 10:11:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72979/connectivity-nrf52840-with-bma400-accelerometer-via-i2c-bus" /><item><title>RE: Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/thread/364899?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 10:11:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3da5296b-2333-4563-96e2-6b33f9ab4d81</guid><dc:creator>Manthan Khunt</dc:creator><description>&lt;p&gt;hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also working on sensor BMA400 and my task is the &amp;quot;How to count continue steps count ?&amp;quot;&lt;/p&gt;
&lt;p&gt;and interfacing with nRF52 MCU. In that I got all axis output but now I have to do step counting&amp;nbsp; and that data I have to shear with user smart phone using BLE. And in a day it&amp;#39;s reset the sensor.&lt;/p&gt;
&lt;p&gt;If u solve the problem then please help me to sort out this problem.....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/thread/301325?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 07:42:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84a2bde0-0fad-43c4-9971-c6a807559c1f</guid><dc:creator>ciramor</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I checked my program and it seems to work now. Actually, I have no logic analyzer so I can&amp;#39;t check that I am in burst mode . Below is my program&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_code_t err_code;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t sample_data;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t nSlaveAddr;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t nRegAddr_L;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t nRegAddr_M;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint16_t Acc_X;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint16_t Acc_Y;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint16_t Acc_Z;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nRegAddr_L = 0x04;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nSlaveAddr = BMA400_I2C_ADDRESS;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t data[6]; // `data` will store the register data&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = nrf_drv_twi_tx(&amp;amp;m_twi, nSlaveAddr, &amp;amp;nRegAddr_L, sizeof(nRegAddr_L), true);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (NRF_SUCCESS == err_code)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = nrf_drv_twi_rx(&amp;amp;m_twi, nSlaveAddr, &amp;amp;data, sizeof(data));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(err_code);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Acc_X = (data[1] &amp;lt;&amp;lt; 8) + data[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Acc_Y = (data[3] &amp;lt;&amp;lt; 8) + data[2];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Acc_Z = (data[5] &amp;lt;&amp;lt; 8) + data[4];&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_INFO(&amp;quot;Acc_X %d.&amp;quot;, Acc_X)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_FLUSH();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_INFO(&amp;quot;Acc_Y %d.&amp;quot;, Acc_Y)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_FLUSH();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_INFO(&amp;quot;Acc_Z %d.&amp;quot;, Acc_Z)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_LOG_FLUSH();&lt;/p&gt;
&lt;p&gt;When I move my board, values change so it is a good news. Now i have to find how to convert data in float&amp;nbsp; with the signe (if you have an idea :-) ) !! and check that&amp;nbsp; values are relevant !!&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/thread/301294?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 18:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6043e52a-4007-4321-a3b6-2e22c242296a</guid><dc:creator>Kenneth</dc:creator><description>[quote user="ciramor"]I tried to use an array as you propose to me, but it doesn&amp;#39;t work.[/quote]
&lt;p&gt;What didn&amp;#39;t work? Do you have a logic analyzer trace that show what happened?&lt;/p&gt;
&lt;p&gt;How did you declare data and length when passed to nrf_drv_twi_rx()?&lt;/p&gt;
&lt;p&gt;When using twi with EasyDMA you are not intended to evaluate transfers on byte level, instead you prepare the write and read with the appropriate number of bytes that should be written&amp;nbsp;and/or read, and then wait for the callback handler indicating the transfer is finished (if you not using callback handler then you simply wait for each call to return). This is the most CPU and power efficient approach.&lt;/p&gt;
&lt;p&gt;Here is an example I could find on devzone that show reading 1 byte and several bytes:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/11032/i2c-how-do-i-specify-a-register-address-to-read-from-when-calling-nrf_drv_twi_rx"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/11032/i2c-how-do-i-specify-a-register-address-to-read-from-when-calling-nrf_drv_twi_rx&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/thread/301237?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 14:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02c39690-d939-45dd-b442-e0163adc3f52</guid><dc:creator>ciramor</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;I tried to use an array as you propose to me, but it doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;I think that my current function I2CReagReg8 doesn&amp;#39;t respect the datasheet of BMA400 or BNO055 (see extract on my frist post). This function is done only to read one register.&lt;/p&gt;
&lt;p&gt;As shown on the datasheet, I need a function to perform a multiple read in one sequence.&lt;/p&gt;
&lt;p&gt;I just start to program in C. I am surprised to see that there is not already a function to perform that. It is used on BNO055, BMA400 and I think more others. I found many programs to read values of sensors, but they do a loop, so it is not a multiple read in one sequence, but multiple sequence to read n registers.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connectivity nrf52840 with BMA400 (accelerometer) via I2C bus</title><link>https://devzone.nordicsemi.com/thread/300951?ContentTypeID=1</link><pubDate>Fri, 19 Mar 2021 13:38:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0f4769f-1037-4a3a-bee2-b28abe7635e5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think the problem is that you are currently passing length=1 to &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__drv__twi.html#gab135f4b02e2f7dcd8db59f17063617ff"&gt;nrf_drv_twi_rx&lt;/a&gt;(), which tells the driver to only receive one byte. I suggest you try to define &amp;#39;data&amp;#39; as an array instead. The size of the array should reflect the number bytes you expect to receive in response to the command you are sending.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;uint8_t data [&amp;lt;number of bytes you expect to receive&amp;gt;];&lt;/p&gt;
&lt;p&gt;SDK driver documentation for reference: &lt;span&gt;&lt;a title="TWI master" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/hardware_driver_twi.html?cp=7_1_2_0_17"&gt;TWI master&lt;/a&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>