<?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>BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21632/bme280-nrf52-makefile-erro</link><description>Hello Nordic,
i am trying to interface BME280 with nordic nRF52 and SDK v 12.02 using twi_peripheral but i am unable to do it. here in example they are using ls75b whereas i am using BME280. I extracted the BME drivers in root along with BME280 arduino</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Apr 2017 12:09:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21632/bme280-nrf52-makefile-erro" /><item><title>RE: BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/thread/84919?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2017 12:09:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acccd7f3-8115-4132-8645-8abd35d3e209</guid><dc:creator>g.joshi</dc:creator><description>&lt;p&gt;@Hung Bui Sorry for that but i couldn´t find much examples to interface external sensors with nordic board. Well i ´ll try to be more specific next time. Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/thread/84918?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2017 11:35:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf0ef646-f915-401e-9e80-2c07dac5c0da</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;We can&amp;#39;t help if you simply say it doesn&amp;#39;t work and post your code. Please try to find the issue , or at least describe the issue clearly and give us the question. We can give you leads, suggestions, but can&amp;#39;t do the job for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/thread/84917?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2017 14:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10166e6b-d80b-4dda-9d79-c436b5c6f58b</guid><dc:creator>g.joshi</dc:creator><description>&lt;p&gt;i followed the project and made this code but i am not getting the reading.
include &amp;lt;stdio.h&amp;gt;
include &amp;quot;boards.h&amp;quot;
include &amp;quot;app_util_platform.h&amp;quot;
include &amp;quot;app_error.h&amp;quot;
include &amp;quot;nrf_drv_twi.h&amp;quot;
include &amp;quot;nrf_delay.h&amp;quot;&lt;/p&gt;
&lt;p&gt;#define NRF_LOG_MODULE_NAME &amp;quot;APP&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;&lt;/p&gt;
&lt;p&gt;/* TWI instance ID. */
#define TWI_INSTANCE_ID     0&lt;/p&gt;
&lt;p&gt;/* Common addresses definition for temperature sensor. */
#define BME280_ADDR          (0x76)&lt;/p&gt;
&lt;p&gt;#define BME280_REG_TEMP      0xF7
#define BME280_REG_CONF      0xF5
#define BME280_REG_THYST     0xF3
#define BME280_REG_TOS       0xFE&lt;/p&gt;
&lt;p&gt;/* Mode for BME280. */
#define NORMAL_MODE 0U&lt;/p&gt;
&lt;p&gt;/* Indicates if operation on TWI has ended. */
static volatile bool m_xfer_done = false;&lt;/p&gt;
&lt;p&gt;/* TWI instance. */
static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);&lt;/p&gt;
&lt;p&gt;/* Buffer for samples read from temperature sensor. */
static uint8_t m_sample;&lt;/p&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@brief Function for setting active mode on MMA7660 accelerometer.
*/
void BME280_set_mode(void)
{
ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;/* Writing to BME280_REG_CONF &amp;quot;0&amp;quot; set temperature sensor in NORMAL mode. */
uint8_t reg[2] = {BME280_REG_CONF, NORMAL_MODE};
err_code = nrf_drv_twi_tx(&amp;amp;m_twi, BME280_ADDR, reg, sizeof(reg), false);
APP_ERROR_CHECK(err_code);
while (m_xfer_done == false);&lt;/p&gt;
&lt;p&gt;/* Writing to pointer byte. */
reg[0] = BME280_REG_TEMP;
m_xfer_done = false;
err_code = nrf_drv_twi_tx(&amp;amp;m_twi, BME280_ADDR, reg, 1, false);
APP_ERROR_CHECK(err_code);
while (m_xfer_done == false);
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;@brief Function for handling data from temperature sensor.&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li&gt;@param[in] temp          Temperature in Celsius degrees read from sensor.
*/
__STATIC_INLINE void data_handler(uint8_t temp)
{
NRF_LOG_INFO(&amp;quot;Temperature: %d Celsius degrees.\r\n&amp;quot;, temp);
}&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;@brief TWI events handler.
*/
void twi_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
switch (p_event-&amp;gt;type)
{
case NRF_DRV_TWI_EVT_DONE:
if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_RX)
{
data_handler(m_sample);
}
m_xfer_done = true;
break;
default:
break;
}
}&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@brief UART initialization.
*/
void twi_init (void)
{
ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;const nrf_drv_twi_config_t twi_BME280_config = {
.scl                = ARDUINO_SCL_PIN,
.sda                = ARDUINO_SDA_PIN,
.frequency          = NRF_TWI_FREQ_400K,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH,
.clear_bus_init     = false
};&lt;/p&gt;
&lt;p&gt;err_code = nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_BME280_config, twi_handler, NULL);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;nrf_drv_twi_enable(&amp;amp;m_twi);
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@brief Function for reading data from temperature sensor.
*/
static void read_sensor_data()
{
m_xfer_done = false;&lt;/p&gt;
&lt;p&gt;/* Read 1 byte from the specified address - skip 3 bits dedicated for fractional part of temperature. */
ret_code_t err_code = nrf_drv_twi_rx(&amp;amp;m_twi, BME280_ADDR, &amp;amp;m_sample, sizeof(m_sample));
APP_ERROR_CHECK(err_code);
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@brief Function for main application entry.
*/
int main(void)
{
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));&lt;/p&gt;
&lt;p&gt;NRF_LOG_INFO(&amp;quot;\r\nTWI sensor example\r\n&amp;quot;);
NRF_LOG_FLUSH();
twi_init();
BME280_set_mode();&lt;/p&gt;
&lt;p&gt;while (true)
{
nrf_delay_ms(500);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; do
 {
     __WFE();
 }while (m_xfer_done == false);

 read_sensor_data();
 NRF_LOG_FLUSH();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/** @} */&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/thread/84916?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2017 12:01:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a752c97-923d-4d94-802e-f6692d2ec8cc</guid><dc:creator>g.joshi</dc:creator><description>&lt;p&gt;Thanks @Hung Bui i will try to do that .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BME280 + nRF52 makefile erro</title><link>https://devzone.nordicsemi.com/thread/84915?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2017 09:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:775c42d1-9d93-44b8-af05-357734ff4e0d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi g.joshi,&lt;/p&gt;
&lt;p&gt;I can see that the code was for MMA7660. I don&amp;#39;t think it would be related to your BME280. I saw that someone asked about it &lt;a href="https://devzone.nordicsemi.com/question/122117/how-can-i-reuse-this-library-into-twi-library-in-nrf52/"&gt;here&lt;/a&gt;.
You also need to look into the datasheet of the BME280 to see how it work and what kind of TWI command you need to send to it to understand the Arduino library when you porting it to the nRF52&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>