{"action":"created","issue":{"url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/29","repository_url":"https://api.github.com/repos/BoschSensortec/BMI160_driver","labels_url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/29/comments","events_url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/29/events","html_url":"https://github.com/BoschSensortec/BMI160_driver/issues/29","id":290168020,"number":29,"title":"Reading Zero for Acceleration X Y Z ","user":{"login":"SikkaTheCoder","id":35620697,"avatar_url":"https://avatars1.githubusercontent.com/u/35620697?v=4","gravatar_id":"","url":"https://api.github.com/users/SikkaTheCoder","html_url":"https://github.com/SikkaTheCoder","followers_url":"https://api.github.com/users/SikkaTheCoder/followers","following_url":"https://api.github.com/users/SikkaTheCoder/following{/other_user}","gists_url":"https://api.github.com/users/SikkaTheCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/SikkaTheCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SikkaTheCoder/subscriptions","organizations_url":"https://api.github.com/users/SikkaTheCoder/orgs","repos_url":"https://api.github.com/users/SikkaTheCoder/repos","events_url":"https://api.github.com/users/SikkaTheCoder/events{/privacy}","received_events_url":"https://api.github.com/users/SikkaTheCoder/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-20T05:48:56Z","updated_at":"2018-03-15T16:24:44Z","closed_at":"2018-01-20T06:10:44Z","author_association":"NONE","body":"Hello,\r\n\r\nFirst of all thank you for the great library. I am using the BMI160 with I2C using the Nordic NRF52840 microcontroller. This controller has a driver for I2C referred to as [nrf_drv_twi](http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.3.0%2Ftwi_scanner_example.html&cp=4_0_3_4_5_34).\r\n\r\nWhen I use the get sensor data function, I am reading zeros for acceleration. However, the sensor time register that is being read is populating with data. Thus, I am confused as to why the acceleration values are zero as I am vigorously shaking the sensor.\r\n\r\nWhen I started investigating further, I noticed that when I read register 0x40 directly, I get back 0x28. This is the default configuration for the acceleration config register, however, I had changed the acceleration frequency to 1600Hz, so I would expect a C for the LSB.\r\n\r\nThis is my write implementation.\r\n\r\n```\r\nint8_t nrf_drv_bmi160_twi_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t * p_data, uint16_t len)\r\n{\r\n\tret_code_t\t\terr_code;\r\n\tuint32_t\t\ttimeout = PARAM_TWI_TIMEOUT;\r\n\t\r\n\terr_code = nrf_drv_twi_tx(&m_bmi160_twi_instance, dev_addr, &reg_addr, len, false);\r\n\tif (err_code != NRF_SUCCESS) return BMI160_E_COM_FAIL;\r\n\t\r\n\t// Wait for TWI_TX_DONE event from the event handler.\r\n\twhile(!twi_tx_done && --timeout);\r\n\tif (!timeout) return BMI160_E_COM_FAIL;\r\n\ttwi_tx_done = false;\r\n\t\r\n\treturn err_code == NRF_SUCCESS ?  BMI160_OK : BMI160_E_COM_FAIL;\r\n}\r\n```\r\n\r\nThe NRF driver function for TWI transmits the register address to the slave and waits for a transmit done. I realized that I have not sent the data yet to write to the register in my implementation. How do I form the data that needs to be sent over using the nrf_drv_twi function? Do I do two write processes, one of the registry to write to, and the second with the data?\r\n\r\nI am trying to follow this:\r\n\r\n![image](https://user-images.githubusercontent.com/35620697/35180316-aae05dbe-fd7b-11e7-85f2-abd750e0898e.png)\r\n\r\nAny help would be appreciated. \r\n\r\nThanks,\r\n\r\nRishi\r\n"},"comment":{"url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/comments/373436903","html_url":"https://github.com/BoschSensortec/BMI160_driver/issues/29#issuecomment-373436903","issue_url":"https://api.github.com/repos/BoschSensortec/BMI160_driver/issues/29","id":373436903,"user":{"login":"BoschSensortec","id":7334913,"avatar_url":"https://avatars2.githubusercontent.com/u/7334913?v=4","gravatar_id":"","url":"https://api.github.com/users/BoschSensortec","html_url":"https://github.com/BoschSensortec","followers_url":"https://api.github.com/users/BoschSensortec/followers","following_url":"https://api.github.com/users/BoschSensortec/following{/other_user}","gists_url":"https://api.github.com/users/BoschSensortec/gists{/gist_id}","starred_url":"https://api.github.com/users/BoschSensortec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoschSensortec/subscriptions","organizations_url":"https://api.github.com/users/BoschSensortec/orgs","repos_url":"https://api.github.com/users/BoschSensortec/repos","events_url":"https://api.github.com/users/BoschSensortec/events{/privacy}","received_events_url":"https://api.github.com/users/BoschSensortec/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T16:24:44Z","updated_at":"2018-03-15T16:24:44Z","author_association":"OWNER","body":"@SikkaTheCoder,\r\n\r\nWe overlooked it a while ago,  but the packet should be of size ```len + 1```. Here ```*p_data``` is an array of size ```len```. The rest of the bytes need to be copied too."}}
{"actor":{"display_login":"BoschSensortec"}}